
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
  <head>
    <meta http-equiv="X-UA-Compatible" content="IE=Edge" />
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Django 1.10 release notes &#8212; Django 1.11.22.dev20190603194737 documentation</title>
    <link rel="stylesheet" href="../_static/default.css" type="text/css" />
    <link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
    <script type="text/javascript" id="documentation_options" data-url_root="../" src="../_static/documentation_options.js"></script>
    <script type="text/javascript" src="../_static/jquery.js"></script>
    <script type="text/javascript" src="../_static/underscore.js"></script>
    <script type="text/javascript" src="../_static/doctools.js"></script>
    <script type="text/javascript" src="../_static/language_data.js"></script>
    <link rel="index" title="Index" href="../genindex.html" />
    <link rel="search" title="Search" href="../search.html" />
    <link rel="next" title="Django 1.9.13 release notes" href="1.9.13.html" />
    <link rel="prev" title="Django 1.10.1 release notes" href="1.10.1.html" />



 
<script type="text/javascript" src="../templatebuiltins.js"></script>
<script type="text/javascript">
(function($) {
    if (!django_template_builtins) {
       // templatebuiltins.js missing, do nothing.
       return;
    }
    $(document).ready(function() {
        // Hyperlink Django template tags and filters
        var base = "../ref/templates/builtins.html";
        if (base == "#") {
            // Special case for builtins.html itself
            base = "";
        }
        // Tags are keywords, class '.k'
        $("div.highlight\\-html\\+django span.k").each(function(i, elem) {
             var tagname = $(elem).text();
             if ($.inArray(tagname, django_template_builtins.ttags) != -1) {
                 var fragment = tagname.replace(/_/, '-');
                 $(elem).html("<a href='" + base + "#" + fragment + "'>" + tagname + "</a>");
             }
        });
        // Filters are functions, class '.nf'
        $("div.highlight\\-html\\+django span.nf").each(function(i, elem) {
             var filtername = $(elem).text();
             if ($.inArray(filtername, django_template_builtins.tfilters) != -1) {
                 var fragment = filtername.replace(/_/, '-');
                 $(elem).html("<a href='" + base + "#" + fragment + "'>" + filtername + "</a>");
             }
        });
    });
})(jQuery);
</script>


  </head><body>

    <div class="document">
  <div id="custom-doc" class="yui-t6">
    <div id="hd">
      <h1><a href="../index.html">Django 1.11.22.dev20190603194737 documentation</a></h1>
      <div id="global-nav">
        <a title="Home page" href="../index.html">Home</a>  |
        <a title="Table of contents" href="../contents.html">Table of contents</a>  |
        <a title="Global index" href="../genindex.html">Index</a>  |
        <a title="Module index" href="../py-modindex.html">Modules</a>
      </div>
      <div class="nav">
    &laquo; <a href="1.10.1.html" title="Django 1.10.1 release notes">previous</a>
     |
    <a href="index.html" title="Release notes" accesskey="U">up</a>
   |
    <a href="1.9.13.html" title="Django 1.9.13 release notes">next</a> &raquo;</div>
    </div>

    <div id="bd">
      <div id="yui-main">
        <div class="yui-b">
          <div class="yui-g" id="releases-1.10">
            
  <div class="section" id="s-django-1-10-release-notes">
<span id="django-1-10-release-notes"></span><h1>Django 1.10 release notes<a class="headerlink" href="#django-1-10-release-notes" title="Permalink to this headline">¶</a></h1>
<p><em>August 1, 2016</em></p>
<p>Welcome to Django 1.10!</p>
<p>These release notes cover the <a class="reference internal" href="#whats-new-1-10"><span class="std std-ref">new features</span></a>, as well as
some <a class="reference internal" href="#backwards-incompatible-1-10"><span class="std std-ref">backwards incompatible changes</span></a> you’ll
want to be aware of when upgrading from Django 1.9 or older versions. We’ve
<a class="reference internal" href="#removed-features-1-10"><span class="std std-ref">dropped some features</span></a> that have reached the end
of their deprecation cycle, and we’ve <a class="reference internal" href="#deprecated-features-1-10"><span class="std std-ref">begun the deprecation process for
some features</span></a>.</p>
<p>See the <a class="reference internal" href="../howto/upgrade-version.html"><span class="doc">Upgrading Django to a newer version</span></a> guide if you’re updating an existing
project.</p>
<div class="section" id="s-python-compatibility">
<span id="python-compatibility"></span><h2>Python compatibility<a class="headerlink" href="#python-compatibility" title="Permalink to this headline">¶</a></h2>
<p>Like Django 1.9, Django 1.10 requires Python 2.7, 3.4, or 3.5. We <strong>highly
recommend</strong> and only officially support the latest release of each series.</p>
</div>
<div class="section" id="s-what-s-new-in-django-1-10">
<span id="s-whats-new-1-10"></span><span id="what-s-new-in-django-1-10"></span><span id="whats-new-1-10"></span><h2>What’s new in Django 1.10<a class="headerlink" href="#what-s-new-in-django-1-10" title="Permalink to this headline">¶</a></h2>
<div class="section" id="s-full-text-search-for-postgresql">
<span id="full-text-search-for-postgresql"></span><h3>Full text search for PostgreSQL<a class="headerlink" href="#full-text-search-for-postgresql" title="Permalink to this headline">¶</a></h3>
<p><code class="docutils literal notranslate"><span class="pre">django.contrib.postgres</span></code> now includes a <a class="reference internal" href="../ref/contrib/postgres/search.html"><span class="doc">collection of database
functions</span></a> to allow the use of the full text
search engine. You can search across multiple fields in your relational
database, combine the searches with other lookups, use different language
configurations and weightings, and rank the results by relevance.</p>
<p>It also now includes trigram support, using the <a class="reference internal" href="../ref/contrib/postgres/lookups.html#std:fieldlookup-trigram_similar"><code class="xref std std-lookup docutils literal notranslate"><span class="pre">trigram_similar</span></code></a>
lookup, and the <a class="reference internal" href="../ref/contrib/postgres/search.html#django.contrib.postgres.search.TrigramSimilarity" title="django.contrib.postgres.search.TrigramSimilarity"><code class="xref py py-class docutils literal notranslate"><span class="pre">TrigramSimilarity</span></code></a> and
<a class="reference internal" href="../ref/contrib/postgres/search.html#django.contrib.postgres.search.TrigramDistance" title="django.contrib.postgres.search.TrigramDistance"><code class="xref py py-class docutils literal notranslate"><span class="pre">TrigramDistance</span></code></a> expressions.</p>
</div>
<div class="section" id="s-new-style-middleware">
<span id="new-style-middleware"></span><h3>New-style middleware<a class="headerlink" href="#new-style-middleware" title="Permalink to this headline">¶</a></h3>
<p><a class="reference internal" href="../topics/http/middleware.html"><span class="doc">A new style of middleware is introduced</span></a> to
solve the lack of strict request/response layering of the old-style of
middleware described in <a class="reference external" href="https://github.com/django/deps/blob/master/final/0005-improved-middleware.rst">DEP 0005</a>.
You’ll need to <a class="reference internal" href="../topics/http/middleware.html#upgrading-middleware"><span class="std std-ref">adapt old, custom middleware</span></a> and
switch from the <code class="docutils literal notranslate"><span class="pre">MIDDLEWARE_CLASSES</span></code> setting to the new <a class="reference internal" href="../ref/settings.html#std:setting-MIDDLEWARE"><code class="xref std std-setting docutils literal notranslate"><span class="pre">MIDDLEWARE</span></code></a>
setting to take advantage of the improvements.</p>
</div>
<div class="section" id="s-official-support-for-unicode-usernames">
<span id="official-support-for-unicode-usernames"></span><h3>Official support for Unicode usernames<a class="headerlink" href="#official-support-for-unicode-usernames" title="Permalink to this headline">¶</a></h3>
<p>The <a class="reference internal" href="../ref/contrib/auth.html#django.contrib.auth.models.User" title="django.contrib.auth.models.User"><code class="xref py py-class docutils literal notranslate"><span class="pre">User</span></code></a> model in <code class="docutils literal notranslate"><span class="pre">django.contrib.auth</span></code>
originally only accepted ASCII letters and numbers in usernames. Although it
wasn’t a deliberate choice, Unicode characters have always been accepted when
using Python 3.</p>
<p>The username validator now explicitly accepts Unicode characters by
default on Python 3 only.</p>
<p>Custom user models may use the new
<a class="reference internal" href="../ref/contrib/auth.html#django.contrib.auth.validators.ASCIIUsernameValidator" title="django.contrib.auth.validators.ASCIIUsernameValidator"><code class="xref py py-class docutils literal notranslate"><span class="pre">ASCIIUsernameValidator</span></code></a> or
<a class="reference internal" href="../ref/contrib/auth.html#django.contrib.auth.validators.UnicodeUsernameValidator" title="django.contrib.auth.validators.UnicodeUsernameValidator"><code class="xref py py-class docutils literal notranslate"><span class="pre">UnicodeUsernameValidator</span></code></a>.</p>
</div>
<div class="section" id="s-minor-features">
<span id="minor-features"></span><h3>Minor features<a class="headerlink" href="#minor-features" title="Permalink to this headline">¶</a></h3>
<div class="section" id="s-django-contrib-admin">
<span id="django-contrib-admin"></span><h4><a class="reference internal" href="../ref/contrib/admin/index.html#module-django.contrib.admin" title="django.contrib.admin: Django's admin site."><code class="xref py py-mod docutils literal notranslate"><span class="pre">django.contrib.admin</span></code></a><a class="headerlink" href="#django-contrib-admin" title="Permalink to this headline">¶</a></h4>
<ul class="simple">
<li>For sites running on a subpath, the default <a class="reference internal" href="../ref/contrib/admin/index.html#django.contrib.admin.AdminSite.site_url" title="django.contrib.admin.AdminSite.site_url"><code class="xref py py-attr docutils literal notranslate"><span class="pre">URL</span> <span class="pre">for</span> <span class="pre">the</span> <span class="pre">&quot;View</span> <span class="pre">site&quot;</span>
<span class="pre">link</span></code></a> at the top of each admin page
will now point to <code class="docutils literal notranslate"><span class="pre">request.META['SCRIPT_NAME']</span></code> if set, instead of <code class="docutils literal notranslate"><span class="pre">/</span></code>.</li>
<li>The success message that appears after adding or editing an object now
contains a link to the object’s change form.</li>
<li>All inline JavaScript is removed so you can enable the
<code class="docutils literal notranslate"><span class="pre">Content-Security-Policy</span></code> HTTP header if you wish.</li>
<li>The new <a class="reference internal" href="../ref/contrib/admin/index.html#django.contrib.admin.InlineModelAdmin.classes" title="django.contrib.admin.InlineModelAdmin.classes"><code class="xref py py-attr docutils literal notranslate"><span class="pre">InlineModelAdmin.classes</span></code></a> attribute allows specifying
classes on inline fieldsets. Inlines with a <code class="docutils literal notranslate"><span class="pre">collapse</span></code> class will be
initially collapsed and their header will have a small “show” link.</li>
<li>If a user doesn’t have the add permission, the <code class="docutils literal notranslate"><span class="pre">object-tools</span></code> block on a
model’s changelist will now be rendered (without the add button, of course).
This makes it easier to add custom tools in this case.</li>
<li>The <a class="reference internal" href="../ref/contrib/admin/index.html#django.contrib.admin.models.LogEntry" title="django.contrib.admin.models.LogEntry"><code class="xref py py-class docutils literal notranslate"><span class="pre">LogEntry</span></code></a> model now stores change
messages in a JSON structure so that the message can be dynamically translated
using the current active language. A new <code class="docutils literal notranslate"><span class="pre">LogEntry.get_change_message()</span></code>
method is now the preferred way of retrieving the change message.</li>
<li>Selected objects for fields in <code class="docutils literal notranslate"><span class="pre">ModelAdmin.raw_id_fields</span></code> now have a link
to object’s change form.</li>
<li>Added “No date” and “Has date” choices for <code class="docutils literal notranslate"><span class="pre">DateFieldListFilter</span></code> if the
field is nullable.</li>
<li>The jQuery library embedded in the admin is upgraded from version 2.1.4 to
2.2.3.</li>
</ul>
</div>
<div class="section" id="s-django-contrib-auth">
<span id="django-contrib-auth"></span><h4><a class="reference internal" href="../topics/auth/index.html#module-django.contrib.auth" title="django.contrib.auth: Django's authentication framework."><code class="xref py py-mod docutils literal notranslate"><span class="pre">django.contrib.auth</span></code></a><a class="headerlink" href="#django-contrib-auth" title="Permalink to this headline">¶</a></h4>
<ul class="simple">
<li>Added support for the <a class="reference internal" href="../topics/auth/passwords.html#argon2-usage"><span class="std std-ref">Argon2 password hash</span></a>. It’s
recommended over PBKDF2, however, it’s not the default as it requires a
third-party library.</li>
<li>The default iteration count for the PBKDF2 password hasher has been increased
by 25%. This backwards compatible change will not affect users who have
subclassed <code class="docutils literal notranslate"><span class="pre">django.contrib.auth.hashers.PBKDF2PasswordHasher</span></code> to change the
default value.</li>
<li>The <a class="reference internal" href="../topics/auth/default.html#django.contrib.auth.views.logout" title="django.contrib.auth.views.logout"><code class="xref py py-func docutils literal notranslate"><span class="pre">logout()</span></code></a> view sends “no-cache” headers
to prevent an issue where Safari caches redirects and prevents a user from
being able to log out.</li>
<li>Added the optional <code class="docutils literal notranslate"><span class="pre">backend</span></code> argument to <a class="reference internal" href="../topics/auth/default.html#django.contrib.auth.login" title="django.contrib.auth.login"><code class="xref py py-func docutils literal notranslate"><span class="pre">login()</span></code></a>
to allow using it without credentials.</li>
<li>The new <a class="reference internal" href="../ref/settings.html#std:setting-LOGOUT_REDIRECT_URL"><code class="xref std std-setting docutils literal notranslate"><span class="pre">LOGOUT_REDIRECT_URL</span></code></a> setting controls the redirect of the
<a class="reference internal" href="../topics/auth/default.html#django.contrib.auth.views.logout" title="django.contrib.auth.views.logout"><code class="xref py py-func docutils literal notranslate"><span class="pre">logout()</span></code></a> view, if the view doesn’t get a
<code class="docutils literal notranslate"><span class="pre">next_page</span></code> argument.</li>
<li>The new <code class="docutils literal notranslate"><span class="pre">redirect_authenticated_user</span></code> parameter for the
<a class="reference internal" href="../topics/auth/default.html#django.contrib.auth.views.login" title="django.contrib.auth.views.login"><code class="xref py py-func docutils literal notranslate"><span class="pre">login()</span></code></a> view allows redirecting
authenticated users visiting the login page.</li>
<li>The new <a class="reference internal" href="../ref/contrib/auth.html#django.contrib.auth.backends.AllowAllUsersModelBackend" title="django.contrib.auth.backends.AllowAllUsersModelBackend"><code class="xref py py-class docutils literal notranslate"><span class="pre">AllowAllUsersModelBackend</span></code></a> and
<a class="reference internal" href="../ref/contrib/auth.html#django.contrib.auth.backends.AllowAllUsersRemoteUserBackend" title="django.contrib.auth.backends.AllowAllUsersRemoteUserBackend"><code class="xref py py-class docutils literal notranslate"><span class="pre">AllowAllUsersRemoteUserBackend</span></code></a> ignore
the value of <code class="docutils literal notranslate"><span class="pre">User.is_active</span></code>, while
<a class="reference internal" href="../ref/contrib/auth.html#django.contrib.auth.backends.ModelBackend" title="django.contrib.auth.backends.ModelBackend"><code class="xref py py-class docutils literal notranslate"><span class="pre">ModelBackend</span></code></a> and
<a class="reference internal" href="../ref/contrib/auth.html#django.contrib.auth.backends.RemoteUserBackend" title="django.contrib.auth.backends.RemoteUserBackend"><code class="xref py py-class docutils literal notranslate"><span class="pre">RemoteUserBackend</span></code></a> now reject inactive
users.</li>
</ul>
</div>
<div class="section" id="s-django-contrib-gis">
<span id="django-contrib-gis"></span><h4><a class="reference internal" href="../ref/contrib/gis/index.html#module-django.contrib.gis" title="django.contrib.gis: Geographic Information System (GIS) extensions for Django"><code class="xref py py-mod docutils literal notranslate"><span class="pre">django.contrib.gis</span></code></a><a class="headerlink" href="#django-contrib-gis" title="Permalink to this headline">¶</a></h4>
<ul class="simple">
<li><a class="reference internal" href="../ref/contrib/gis/geoquerysets.html#distance-lookups"><span class="std std-ref">Distance lookups</span></a> now accept expressions as the
distance value parameter.</li>
<li>The new <a class="reference internal" href="../ref/contrib/gis/geos.html#django.contrib.gis.geos.GEOSGeometry.unary_union" title="django.contrib.gis.geos.GEOSGeometry.unary_union"><code class="xref py py-attr docutils literal notranslate"><span class="pre">GEOSGeometry.unary_union</span></code></a> property computes the
union of all the elements of this geometry.</li>
<li>Added the <a class="reference internal" href="../ref/contrib/gis/geos.html#django.contrib.gis.geos.GEOSGeometry.covers" title="django.contrib.gis.geos.GEOSGeometry.covers"><code class="xref py py-meth docutils literal notranslate"><span class="pre">GEOSGeometry.covers()</span></code></a> binary predicate.</li>
<li>Added the <a class="reference internal" href="../ref/contrib/gis/gdal.html#django.contrib.gis.gdal.GDALBand.statistics" title="django.contrib.gis.gdal.GDALBand.statistics"><code class="xref py py-meth docutils literal notranslate"><span class="pre">GDALBand.statistics()</span></code></a> method and
<a class="reference internal" href="../ref/contrib/gis/gdal.html#django.contrib.gis.gdal.GDALBand.mean" title="django.contrib.gis.gdal.GDALBand.mean"><code class="xref py py-attr docutils literal notranslate"><span class="pre">mean</span></code></a>
and <a class="reference internal" href="../ref/contrib/gis/gdal.html#django.contrib.gis.gdal.GDALBand.std" title="django.contrib.gis.gdal.GDALBand.std"><code class="xref py py-attr docutils literal notranslate"><span class="pre">std</span></code></a> attributes.</li>
<li>Added support for the <a class="reference internal" href="../ref/contrib/gis/geoquerysets.html#django.contrib.gis.db.models.MakeLine" title="django.contrib.gis.db.models.MakeLine"><code class="xref py py-class docutils literal notranslate"><span class="pre">MakeLine</span></code></a>
aggregate and <a class="reference internal" href="../ref/contrib/gis/functions.html#django.contrib.gis.db.models.functions.GeoHash" title="django.contrib.gis.db.models.functions.GeoHash"><code class="xref py py-class docutils literal notranslate"><span class="pre">GeoHash</span></code></a>
function on SpatiaLite.</li>
<li>Added support for the
<a class="reference internal" href="../ref/contrib/gis/functions.html#django.contrib.gis.db.models.functions.Difference" title="django.contrib.gis.db.models.functions.Difference"><code class="xref py py-class docutils literal notranslate"><span class="pre">Difference</span></code></a>,
<a class="reference internal" href="../ref/contrib/gis/functions.html#django.contrib.gis.db.models.functions.Intersection" title="django.contrib.gis.db.models.functions.Intersection"><code class="xref py py-class docutils literal notranslate"><span class="pre">Intersection</span></code></a>, and
<a class="reference internal" href="../ref/contrib/gis/functions.html#django.contrib.gis.db.models.functions.SymDifference" title="django.contrib.gis.db.models.functions.SymDifference"><code class="xref py py-class docutils literal notranslate"><span class="pre">SymDifference</span></code></a>
functions on MySQL.</li>
<li>Added support for instantiating empty GEOS geometries.</li>
<li>The new <a class="reference internal" href="../ref/contrib/gis/geos.html#django.contrib.gis.geos.WKTWriter.trim" title="django.contrib.gis.geos.WKTWriter.trim"><code class="xref py py-attr docutils literal notranslate"><span class="pre">trim</span></code></a> and
<a class="reference internal" href="../ref/contrib/gis/geos.html#django.contrib.gis.geos.WKTWriter.precision" title="django.contrib.gis.geos.WKTWriter.precision"><code class="xref py py-attr docutils literal notranslate"><span class="pre">precision</span></code></a> properties
of <a class="reference internal" href="../ref/contrib/gis/geos.html#django.contrib.gis.geos.WKTWriter" title="django.contrib.gis.geos.WKTWriter"><code class="xref py py-class docutils literal notranslate"><span class="pre">WKTWriter</span></code></a> allow controlling
output of the fractional part of the coordinates in WKT.</li>
<li>Added the <a class="reference internal" href="../ref/contrib/gis/geos.html#django.contrib.gis.geos.LineString.closed" title="django.contrib.gis.geos.LineString.closed"><code class="xref py py-attr docutils literal notranslate"><span class="pre">LineString.closed</span></code></a> and
<a class="reference internal" href="../ref/contrib/gis/geos.html#django.contrib.gis.geos.MultiLineString.closed" title="django.contrib.gis.geos.MultiLineString.closed"><code class="xref py py-attr docutils literal notranslate"><span class="pre">MultiLineString.closed</span></code></a> properties.</li>
<li>The <a class="reference internal" href="../ref/contrib/gis/serializers.html"><span class="doc">GeoJSON serializer</span></a> now outputs the
primary key of objects in the <code class="docutils literal notranslate"><span class="pre">properties</span></code> dictionary if specific fields
aren’t specified.</li>
<li>The ability to replicate input data on the <a class="reference internal" href="../ref/contrib/gis/gdal.html#django.contrib.gis.gdal.GDALBand.data" title="django.contrib.gis.gdal.GDALBand.data"><code class="xref py py-meth docutils literal notranslate"><span class="pre">GDALBand.data()</span></code></a> method was added. Band data can
now be updated with repeated values efficiently.</li>
<li>Added database functions
<a class="reference internal" href="../ref/contrib/gis/functions.html#django.contrib.gis.db.models.functions.IsValid" title="django.contrib.gis.db.models.functions.IsValid"><code class="xref py py-class docutils literal notranslate"><span class="pre">IsValid</span></code></a> and
<a class="reference internal" href="../ref/contrib/gis/functions.html#django.contrib.gis.db.models.functions.MakeValid" title="django.contrib.gis.db.models.functions.MakeValid"><code class="xref py py-class docutils literal notranslate"><span class="pre">MakeValid</span></code></a>, as well as the
<a class="reference internal" href="../ref/contrib/gis/geoquerysets.html#std:fieldlookup-isvalid"><code class="xref std std-lookup docutils literal notranslate"><span class="pre">isvalid</span></code></a> lookup, all for PostGIS. This allows filtering and
repairing invalid geometries on the database side.</li>
<li>Added raster support for all <a class="reference internal" href="../ref/contrib/gis/geoquerysets.html"><span class="doc">spatial lookups</span></a>.</li>
</ul>
</div>
<div class="section" id="s-django-contrib-postgres">
<span id="django-contrib-postgres"></span><h4><a class="reference internal" href="../ref/contrib/postgres/index.html#module-django.contrib.postgres" title="django.contrib.postgres: PostgreSQL-specific fields and features"><code class="xref py py-mod docutils literal notranslate"><span class="pre">django.contrib.postgres</span></code></a><a class="headerlink" href="#django-contrib-postgres" title="Permalink to this headline">¶</a></h4>
<ul class="simple">
<li>For convenience, <a class="reference internal" href="../ref/contrib/postgres/fields.html#django.contrib.postgres.fields.HStoreField" title="django.contrib.postgres.fields.HStoreField"><code class="xref py py-class docutils literal notranslate"><span class="pre">HStoreField</span></code></a> now
casts its keys and values to strings.</li>
</ul>
</div>
<div class="section" id="s-django-contrib-sessions">
<span id="django-contrib-sessions"></span><h4><a class="reference internal" href="../topics/http/sessions.html#module-django.contrib.sessions" title="django.contrib.sessions: Provides session management for Django projects."><code class="xref py py-mod docutils literal notranslate"><span class="pre">django.contrib.sessions</span></code></a><a class="headerlink" href="#django-contrib-sessions" title="Permalink to this headline">¶</a></h4>
<ul class="simple">
<li>The <a class="reference internal" href="../ref/django-admin.html#django-admin-clearsessions"><code class="xref std std-djadmin docutils literal notranslate"><span class="pre">clearsessions</span></code></a> management command now removes file-based
sessions.</li>
</ul>
</div>
<div class="section" id="s-django-contrib-sites">
<span id="django-contrib-sites"></span><h4><a class="reference internal" href="../ref/contrib/sites.html#module-django.contrib.sites" title="django.contrib.sites: Lets you operate multiple websites from the same database and Django project"><code class="xref py py-mod docutils literal notranslate"><span class="pre">django.contrib.sites</span></code></a><a class="headerlink" href="#django-contrib-sites" title="Permalink to this headline">¶</a></h4>
<ul class="simple">
<li>The <a class="reference internal" href="../ref/contrib/sites.html#django.contrib.sites.models.Site" title="django.contrib.sites.models.Site"><code class="xref py py-class docutils literal notranslate"><span class="pre">Site</span></code></a> model now supports
<a class="reference internal" href="../topics/serialization.html#topics-serialization-natural-keys"><span class="std std-ref">natural keys</span></a>.</li>
</ul>
</div>
<div class="section" id="s-django-contrib-staticfiles">
<span id="django-contrib-staticfiles"></span><h4><a class="reference internal" href="../ref/contrib/staticfiles.html#module-django.contrib.staticfiles" title="django.contrib.staticfiles: An app for handling static files."><code class="xref py py-mod docutils literal notranslate"><span class="pre">django.contrib.staticfiles</span></code></a><a class="headerlink" href="#django-contrib-staticfiles" title="Permalink to this headline">¶</a></h4>
<ul class="simple">
<li>The <a class="reference internal" href="../ref/templates/builtins.html#std:templatetag-static"><code class="xref std std-ttag docutils literal notranslate"><span class="pre">static</span></code></a> template tag now uses <code class="docutils literal notranslate"><span class="pre">django.contrib.staticfiles</span></code>
if it’s in <code class="docutils literal notranslate"><span class="pre">INSTALLED_APPS</span></code>. This is especially useful for third-party apps
which can now always use <code class="docutils literal notranslate"><span class="pre">{%</span> <span class="pre">load</span> <span class="pre">static</span> <span class="pre">%}</span></code> (instead of
<code class="docutils literal notranslate"><span class="pre">{%</span> <span class="pre">load</span> <span class="pre">staticfiles</span> <span class="pre">%}</span></code> or <code class="docutils literal notranslate"><span class="pre">{%</span> <span class="pre">load</span> <span class="pre">static</span> <span class="pre">from</span> <span class="pre">staticfiles</span> <span class="pre">%}</span></code>) and
not worry about whether or not the <code class="docutils literal notranslate"><span class="pre">staticfiles</span></code> app is installed.</li>
<li>You can <a class="reference internal" href="../ref/contrib/staticfiles.html#customize-staticfiles-ignore-patterns"><span class="std std-ref">more easily customize</span></a>
the <code class="docutils literal notranslate"><span class="pre">collectstatic</span> <span class="pre">--ignore</span></code> option with a custom <code class="docutils literal notranslate"><span class="pre">AppConfig</span></code>.</li>
</ul>
</div>
<div class="section" id="s-cache">
<span id="cache"></span><h4>Cache<a class="headerlink" href="#cache" title="Permalink to this headline">¶</a></h4>
<ul class="simple">
<li>The file-based cache backend now uses the highest pickling protocol.</li>
</ul>
</div>
<div class="section" id="s-csrf">
<span id="csrf"></span><h4>CSRF<a class="headerlink" href="#csrf" title="Permalink to this headline">¶</a></h4>
<ul class="simple">
<li>The default <a class="reference internal" href="../ref/settings.html#std:setting-CSRF_FAILURE_VIEW"><code class="xref std std-setting docutils literal notranslate"><span class="pre">CSRF_FAILURE_VIEW</span></code></a>, <code class="docutils literal notranslate"><span class="pre">views.csrf.csrf_failure()</span></code> now
accepts an optional <code class="docutils literal notranslate"><span class="pre">template_name</span></code> parameter, defaulting to
<code class="docutils literal notranslate"><span class="pre">'403_csrf.html'</span></code>, to control the template used to render the page.</li>
<li>To protect against <a class="reference external" href="http://breachattack.com/">BREACH</a> attacks, the CSRF protection mechanism now
changes the form token value on every request (while keeping an invariant
secret which can be used to validate the different tokens).</li>
</ul>
</div>
<div class="section" id="s-database-backends">
<span id="database-backends"></span><h4>Database backends<a class="headerlink" href="#database-backends" title="Permalink to this headline">¶</a></h4>
<ul class="simple">
<li>Temporal data subtraction was unified on all backends.</li>
<li>If the database supports it, backends can set
<code class="docutils literal notranslate"><span class="pre">DatabaseFeatures.can_return_ids_from_bulk_insert=True</span></code> and implement
<code class="docutils literal notranslate"><span class="pre">DatabaseOperations.fetch_returned_insert_ids()</span></code> to set primary keys
on objects created using <code class="docutils literal notranslate"><span class="pre">QuerySet.bulk_create()</span></code>.</li>
<li>Added keyword arguments to the <code class="docutils literal notranslate"><span class="pre">as_sql()</span></code> methods of various expressions
(<code class="docutils literal notranslate"><span class="pre">Func</span></code>, <code class="docutils literal notranslate"><span class="pre">When</span></code>, <code class="docutils literal notranslate"><span class="pre">Case</span></code>, and <code class="docutils literal notranslate"><span class="pre">OrderBy</span></code>) to allow database backends to
customize them without mutating <code class="docutils literal notranslate"><span class="pre">self</span></code>, which isn’t safe when using
different database backends. See the <code class="docutils literal notranslate"><span class="pre">arg_joiner</span></code> and <code class="docutils literal notranslate"><span class="pre">**extra_context</span></code>
parameters of <a class="reference internal" href="../ref/models/expressions.html#django.db.models.Func.as_sql" title="django.db.models.Func.as_sql"><code class="xref py py-meth docutils literal notranslate"><span class="pre">Func.as_sql()</span></code></a> for an
example.</li>
</ul>
</div>
<div class="section" id="s-file-storage">
<span id="file-storage"></span><h4>File Storage<a class="headerlink" href="#file-storage" title="Permalink to this headline">¶</a></h4>
<ul class="simple">
<li>Storage backends now present a timezone-aware API with new methods
<a class="reference internal" href="../ref/files/storage.html#django.core.files.storage.Storage.get_accessed_time" title="django.core.files.storage.Storage.get_accessed_time"><code class="xref py py-meth docutils literal notranslate"><span class="pre">get_accessed_time()</span></code></a>,
<a class="reference internal" href="../ref/files/storage.html#django.core.files.storage.Storage.get_created_time" title="django.core.files.storage.Storage.get_created_time"><code class="xref py py-meth docutils literal notranslate"><span class="pre">get_created_time()</span></code></a>, and
<a class="reference internal" href="../ref/files/storage.html#django.core.files.storage.Storage.get_modified_time" title="django.core.files.storage.Storage.get_modified_time"><code class="xref py py-meth docutils literal notranslate"><span class="pre">get_modified_time()</span></code></a>. They return a
timezone-aware <code class="docutils literal notranslate"><span class="pre">datetime</span></code> if <a class="reference internal" href="../ref/settings.html#std:setting-USE_TZ"><code class="xref std std-setting docutils literal notranslate"><span class="pre">USE_TZ</span></code></a> is <code class="docutils literal notranslate"><span class="pre">True</span></code> and a naive
<code class="docutils literal notranslate"><span class="pre">datetime</span></code> in the local timezone otherwise.</li>
<li>The new <a class="reference internal" href="../ref/files/storage.html#django.core.files.storage.Storage.generate_filename" title="django.core.files.storage.Storage.generate_filename"><code class="xref py py-meth docutils literal notranslate"><span class="pre">Storage.generate_filename()</span></code></a> method makes it easier
to implement custom storages that don’t use the <code class="docutils literal notranslate"><span class="pre">os.path</span></code> calls previously
in <a class="reference internal" href="../ref/models/fields.html#django.db.models.FileField" title="django.db.models.FileField"><code class="xref py py-class docutils literal notranslate"><span class="pre">FileField</span></code></a>.</li>
</ul>
</div>
<div class="section" id="s-forms">
<span id="forms"></span><h4>Forms<a class="headerlink" href="#forms" title="Permalink to this headline">¶</a></h4>
<ul class="simple">
<li>Form and widget <code class="docutils literal notranslate"><span class="pre">Media</span></code> is now served using
<a class="reference internal" href="../ref/contrib/staticfiles.html#module-django.contrib.staticfiles" title="django.contrib.staticfiles: An app for handling static files."><code class="xref py py-mod docutils literal notranslate"><span class="pre">django.contrib.staticfiles</span></code></a> if installed.</li>
<li>The <code class="docutils literal notranslate"><span class="pre">&lt;input&gt;</span></code> tag rendered by <a class="reference internal" href="../ref/forms/fields.html#django.forms.CharField" title="django.forms.CharField"><code class="xref py py-class docutils literal notranslate"><span class="pre">CharField</span></code></a> now includes
a <code class="docutils literal notranslate"><span class="pre">minlength</span></code> attribute if the field has a <code class="docutils literal notranslate"><span class="pre">min_length</span></code>.</li>
<li>Required form fields now have the <code class="docutils literal notranslate"><span class="pre">required</span></code> HTML attribute. Set the new
<a class="reference internal" href="../ref/forms/api.html#django.forms.Form.use_required_attribute" title="django.forms.Form.use_required_attribute"><code class="xref py py-attr docutils literal notranslate"><span class="pre">Form.use_required_attribute</span></code></a>
attribute to <code class="docutils literal notranslate"><span class="pre">False</span></code> to disable it. The <code class="docutils literal notranslate"><span class="pre">required</span></code> attribute isn’t
included on forms of formsets because the browser validation may not be
correct when adding and deleting formsets.</li>
</ul>
</div>
<div class="section" id="s-generic-views">
<span id="generic-views"></span><h4>Generic Views<a class="headerlink" href="#generic-views" title="Permalink to this headline">¶</a></h4>
<ul class="simple">
<li>The <a class="reference internal" href="../ref/class-based-views/base.html#django.views.generic.base.View" title="django.views.generic.base.View"><code class="xref py py-class docutils literal notranslate"><span class="pre">View</span></code></a> class can now be imported from
<code class="docutils literal notranslate"><span class="pre">django.views</span></code>.</li>
</ul>
</div>
<div class="section" id="s-internationalization">
<span id="internationalization"></span><h4>Internationalization<a class="headerlink" href="#internationalization" title="Permalink to this headline">¶</a></h4>
<ul class="simple">
<li>The <a class="reference internal" href="../topics/i18n/translation.html#django.conf.urls.i18n.i18n_patterns" title="django.conf.urls.i18n.i18n_patterns"><code class="xref py py-func docutils literal notranslate"><span class="pre">i18n_patterns()</span></code></a> helper function can now be
used in a root URLConf specified using <a class="reference internal" href="../ref/request-response.html#django.http.HttpRequest.urlconf" title="django.http.HttpRequest.urlconf"><code class="xref py py-attr docutils literal notranslate"><span class="pre">request.urlconf</span></code></a>.</li>
<li>By setting the new <code class="docutils literal notranslate"><span class="pre">prefix_default_language</span></code> parameter for
<a class="reference internal" href="../topics/i18n/translation.html#django.conf.urls.i18n.i18n_patterns" title="django.conf.urls.i18n.i18n_patterns"><code class="xref py py-func docutils literal notranslate"><span class="pre">i18n_patterns()</span></code></a> to <code class="docutils literal notranslate"><span class="pre">False</span></code>, you can allow
accessing the default language without a URL prefix.</li>
<li><a class="reference internal" href="../topics/i18n/translation.html#django.views.i18n.set_language" title="django.views.i18n.set_language"><code class="xref py py-func docutils literal notranslate"><span class="pre">set_language()</span></code></a> now returns a 204 status code (No
Content) for AJAX requests when there is no <code class="docutils literal notranslate"><span class="pre">next</span></code> parameter in <code class="docutils literal notranslate"><span class="pre">POST</span></code> or
<code class="docutils literal notranslate"><span class="pre">GET</span></code>.</li>
<li>The <a class="reference internal" href="../topics/i18n/translation.html#django.views.i18n.JavaScriptCatalog" title="django.views.i18n.JavaScriptCatalog"><code class="xref py py-class docutils literal notranslate"><span class="pre">JavaScriptCatalog</span></code></a> and
<a class="reference internal" href="../topics/i18n/translation.html#django.views.i18n.JSONCatalog" title="django.views.i18n.JSONCatalog"><code class="xref py py-class docutils literal notranslate"><span class="pre">JSONCatalog</span></code></a> class-based views supersede the
deprecated <code class="docutils literal notranslate"><span class="pre">javascript_catalog()</span></code> and <code class="docutils literal notranslate"><span class="pre">json_catalog()</span></code> function-based
views. The new views are almost equivalent to the old ones except that by
default the new views collect all JavaScript strings in the <code class="docutils literal notranslate"><span class="pre">djangojs</span></code>
translation domain from all installed apps rather than only the JavaScript
strings from <a class="reference internal" href="../ref/settings.html#std:setting-LOCALE_PATHS"><code class="xref std std-setting docutils literal notranslate"><span class="pre">LOCALE_PATHS</span></code></a>.</li>
</ul>
</div>
<div class="section" id="s-management-commands">
<span id="management-commands"></span><h4>Management Commands<a class="headerlink" href="#management-commands" title="Permalink to this headline">¶</a></h4>
<ul class="simple">
<li><a class="reference internal" href="../ref/django-admin.html#django.core.management.call_command" title="django.core.management.call_command"><code class="xref py py-func docutils literal notranslate"><span class="pre">call_command()</span></code></a> now returns the value returned
from the <code class="docutils literal notranslate"><span class="pre">command.handle()</span></code> method.</li>
<li>The new <a class="reference internal" href="../ref/django-admin.html#cmdoption-check-fail-level"><code class="xref std std-option docutils literal notranslate"><span class="pre">check</span> <span class="pre">--fail-level</span></code></a> option allows specifying the message
level that will cause the command to exit with a non-zero status.</li>
<li>The new <a class="reference internal" href="../ref/django-admin.html#cmdoption-makemigrations-check"><code class="xref std std-option docutils literal notranslate"><span class="pre">makemigrations</span> <span class="pre">--check</span></code></a> option makes the command exit
with a non-zero status when model changes without migrations are detected.</li>
<li><a class="reference internal" href="../ref/django-admin.html#django-admin-makemigrations"><code class="xref std std-djadmin docutils literal notranslate"><span class="pre">makemigrations</span></code></a> now displays the path to the migration files that
it generates.</li>
<li>The <a class="reference internal" href="../ref/django-admin.html#cmdoption-shell-interface"><code class="xref std std-option docutils literal notranslate"><span class="pre">shell</span> <span class="pre">--interface</span></code></a> option now accepts <code class="docutils literal notranslate"><span class="pre">python</span></code> to force use of
the “plain” Python interpreter.</li>
<li>The new <a class="reference internal" href="../ref/django-admin.html#cmdoption-shell-command"><code class="xref std std-option docutils literal notranslate"><span class="pre">shell</span> <span class="pre">--command</span></code></a> option lets you run a command as Django and
exit, instead of opening the interactive shell.</li>
<li>Added a warning to <a class="reference internal" href="../ref/django-admin.html#django-admin-dumpdata"><code class="xref std std-djadmin docutils literal notranslate"><span class="pre">dumpdata</span></code></a> if a proxy model is specified (which
results in no output) without its concrete parent.</li>
<li>The new <a class="reference internal" href="../howto/custom-management-commands.html#django.core.management.BaseCommand.requires_migrations_checks" title="django.core.management.BaseCommand.requires_migrations_checks"><code class="xref py py-attr docutils literal notranslate"><span class="pre">BaseCommand.requires_migrations_checks</span></code></a> attribute
may be set to <code class="docutils literal notranslate"><span class="pre">True</span></code> if you want your command to print a warning, like
<a class="reference internal" href="../ref/django-admin.html#django-admin-runserver"><code class="xref std std-djadmin docutils literal notranslate"><span class="pre">runserver</span></code></a> does, if the set of migrations on disk don’t match the
migrations in the database.</li>
<li>To assist with testing, <a class="reference internal" href="../ref/django-admin.html#django.core.management.call_command" title="django.core.management.call_command"><code class="xref py py-func docutils literal notranslate"><span class="pre">call_command()</span></code></a> now
accepts a command object as the first argument.</li>
<li>The <a class="reference internal" href="../ref/django-admin.html#django-admin-shell"><code class="xref std std-djadmin docutils literal notranslate"><span class="pre">shell</span></code></a> command supports tab completion on systems using
<code class="docutils literal notranslate"><span class="pre">libedit</span></code>, e.g. macOS.</li>
<li>The <a class="reference internal" href="../ref/django-admin.html#django-admin-inspectdb"><code class="xref std std-djadmin docutils literal notranslate"><span class="pre">inspectdb</span></code></a> command lets you choose what tables should be
inspected by specifying their names as arguments.</li>
</ul>
</div>
<div class="section" id="s-migrations">
<span id="migrations"></span><h4>Migrations<a class="headerlink" href="#migrations" title="Permalink to this headline">¶</a></h4>
<ul class="simple">
<li>Added support for serialization of <code class="docutils literal notranslate"><span class="pre">enum.Enum</span></code> objects.</li>
<li>Added the <code class="docutils literal notranslate"><span class="pre">elidable</span></code> argument to the
<a class="reference internal" href="../ref/migration-operations.html#django.db.migrations.operations.RunSQL" title="django.db.migrations.operations.RunSQL"><code class="xref py py-class docutils literal notranslate"><span class="pre">RunSQL</span></code></a> and
<a class="reference internal" href="../ref/migration-operations.html#django.db.migrations.operations.RunPython" title="django.db.migrations.operations.RunPython"><code class="xref py py-class docutils literal notranslate"><span class="pre">RunPython</span></code></a> operations to allow them
to be removed when squashing migrations.</li>
<li>Added support for <a class="reference internal" href="../howto/writing-migrations.html#non-atomic-migrations"><span class="std std-ref">non-atomic migrations</span></a> by
setting the <code class="docutils literal notranslate"><span class="pre">atomic</span></code> attribute on a <code class="docutils literal notranslate"><span class="pre">Migration</span></code>.</li>
<li>The <code class="docutils literal notranslate"><span class="pre">migrate</span></code> and <code class="docutils literal notranslate"><span class="pre">makemigrations</span></code> commands now <a class="reference internal" href="../topics/migrations.html#migration-history-consistency"><span class="std std-ref">check for a
consistent migration history</span></a>. If they find
some unapplied dependencies of an applied migration,
<code class="docutils literal notranslate"><span class="pre">InconsistentMigrationHistory</span></code> is raised.</li>
<li>The <a class="reference internal" href="../ref/signals.html#django.db.models.signals.pre_migrate" title="django.db.models.signals.pre_migrate"><code class="xref py py-func docutils literal notranslate"><span class="pre">pre_migrate()</span></code></a> and
<a class="reference internal" href="../ref/signals.html#django.db.models.signals.post_migrate" title="django.db.models.signals.post_migrate"><code class="xref py py-func docutils literal notranslate"><span class="pre">post_migrate()</span></code></a> signals now dispatch their
migration <code class="docutils literal notranslate"><span class="pre">plan</span></code> and <code class="docutils literal notranslate"><span class="pre">apps</span></code>.</li>
</ul>
</div>
<div class="section" id="s-models">
<span id="models"></span><h4>Models<a class="headerlink" href="#models" title="Permalink to this headline">¶</a></h4>
<ul class="simple">
<li>Reverse foreign keys from proxy models are now propagated to their
concrete class. The reverse relation attached by a
<a class="reference internal" href="../ref/models/fields.html#django.db.models.ForeignKey" title="django.db.models.ForeignKey"><code class="xref py py-class docutils literal notranslate"><span class="pre">ForeignKey</span></code></a> pointing to a proxy model is now
accessible as a descriptor on the proxied model class and may be referenced in
queryset filtering.</li>
<li>The new <a class="reference internal" href="../ref/models/fields.html#django.db.models.Field.rel_db_type" title="django.db.models.Field.rel_db_type"><code class="xref py py-meth docutils literal notranslate"><span class="pre">Field.rel_db_type()</span></code></a>
method returns the database column data type for fields such as <code class="docutils literal notranslate"><span class="pre">ForeignKey</span></code>
and <code class="docutils literal notranslate"><span class="pre">OneToOneField</span></code> that point to another field.</li>
<li>The <a class="reference internal" href="../ref/models/expressions.html#django.db.models.Func.arity" title="django.db.models.Func.arity"><code class="xref py py-attr docutils literal notranslate"><span class="pre">arity</span></code></a> class attribute is added to
<a class="reference internal" href="../ref/models/expressions.html#django.db.models.Func" title="django.db.models.Func"><code class="xref py py-class docutils literal notranslate"><span class="pre">Func</span></code></a>. This attribute can be used to set the number
of arguments the function accepts.</li>
<li>Added <a class="reference internal" href="../ref/models/fields.html#django.db.models.BigAutoField" title="django.db.models.BigAutoField"><code class="xref py py-class docutils literal notranslate"><span class="pre">BigAutoField</span></code></a> which acts much like an
<a class="reference internal" href="../ref/models/fields.html#django.db.models.AutoField" title="django.db.models.AutoField"><code class="xref py py-class docutils literal notranslate"><span class="pre">AutoField</span></code></a> except that it is guaranteed
to fit numbers from <code class="docutils literal notranslate"><span class="pre">1</span></code> to <code class="docutils literal notranslate"><span class="pre">9223372036854775807</span></code>.</li>
<li><a class="reference internal" href="../ref/models/querysets.html#django.db.models.query.QuerySet.in_bulk" title="django.db.models.query.QuerySet.in_bulk"><code class="xref py py-meth docutils literal notranslate"><span class="pre">QuerySet.in_bulk()</span></code></a>
may be called without any arguments to return all objects in the queryset.</li>
<li><a class="reference internal" href="../ref/models/fields.html#django.db.models.ForeignKey.related_query_name" title="django.db.models.ForeignKey.related_query_name"><code class="xref py py-attr docutils literal notranslate"><span class="pre">related_query_name</span></code></a> now supports
app label and class interpolation using the <code class="docutils literal notranslate"><span class="pre">'%(app_label)s'</span></code> and
<code class="docutils literal notranslate"><span class="pre">'%(class)s'</span></code> strings.</li>
<li>Allowed overriding model fields inherited from abstract base classes.</li>
<li>The <a class="reference internal" href="../ref/models/querysets.html#django.db.models.prefetch_related_objects" title="django.db.models.prefetch_related_objects"><code class="xref py py-func docutils literal notranslate"><span class="pre">prefetch_related_objects()</span></code></a> function is now a
public API.</li>
<li><a class="reference internal" href="../ref/models/querysets.html#django.db.models.query.QuerySet.bulk_create" title="django.db.models.query.QuerySet.bulk_create"><code class="xref py py-meth docutils literal notranslate"><span class="pre">QuerySet.bulk_create()</span></code></a>
sets the primary key on objects when using PostgreSQL.</li>
<li>Added the <a class="reference internal" href="../ref/models/database-functions.html#django.db.models.functions.Cast" title="django.db.models.functions.Cast"><code class="xref py py-class docutils literal notranslate"><span class="pre">Cast</span></code></a> database function.</li>
<li>A proxy model may now inherit multiple proxy models that share a common
non-abstract parent class.</li>
<li>Added <a class="reference internal" href="../ref/models/database-functions.html#django.db.models.functions.datetime.Extract" title="django.db.models.functions.datetime.Extract"><code class="xref py py-class docutils literal notranslate"><span class="pre">Extract</span></code></a> functions
to extract datetime components as integers, such as year and hour.</li>
<li>Added <a class="reference internal" href="../ref/models/database-functions.html#django.db.models.functions.datetime.Trunc" title="django.db.models.functions.datetime.Trunc"><code class="xref py py-class docutils literal notranslate"><span class="pre">Trunc</span></code></a> functions to
truncate a date or datetime to a significant component. They enable queries
like sales-per-day or sales-per-hour.</li>
<li><code class="docutils literal notranslate"><span class="pre">Model.__init__()</span></code> now sets values of virtual fields from its keyword
arguments.</li>
<li>The new <a class="reference internal" href="../ref/models/options.html#django.db.models.Options.base_manager_name" title="django.db.models.Options.base_manager_name"><code class="xref py py-attr docutils literal notranslate"><span class="pre">Meta.base_manager_name</span></code></a> and
<a class="reference internal" href="../ref/models/options.html#django.db.models.Options.default_manager_name" title="django.db.models.Options.default_manager_name"><code class="xref py py-attr docutils literal notranslate"><span class="pre">Meta.default_manager_name</span></code></a> options allow controlling
the <a class="reference internal" href="../topics/db/managers.html#django.db.models.Model._base_manager" title="django.db.models.Model._base_manager"><code class="xref py py-attr docutils literal notranslate"><span class="pre">_base_manager</span></code></a> and
<a class="reference internal" href="../topics/db/managers.html#django.db.models.Model._default_manager" title="django.db.models.Model._default_manager"><code class="xref py py-attr docutils literal notranslate"><span class="pre">_default_manager</span></code></a>, respectively.</li>
</ul>
</div>
<div class="section" id="s-requests-and-responses">
<span id="requests-and-responses"></span><h4>Requests and Responses<a class="headerlink" href="#requests-and-responses" title="Permalink to this headline">¶</a></h4>
<ul class="simple">
<li>Added <code class="docutils literal notranslate"><span class="pre">request.user</span></code> to the debug view.</li>
<li>Added <a class="reference internal" href="../ref/request-response.html#django.http.HttpResponse" title="django.http.HttpResponse"><code class="xref py py-class docutils literal notranslate"><span class="pre">HttpResponse</span></code></a> methods
<a class="reference internal" href="../ref/request-response.html#django.http.HttpResponse.readable" title="django.http.HttpResponse.readable"><code class="xref py py-meth docutils literal notranslate"><span class="pre">readable()</span></code></a> and
<a class="reference internal" href="../ref/request-response.html#django.http.HttpResponse.seekable" title="django.http.HttpResponse.seekable"><code class="xref py py-meth docutils literal notranslate"><span class="pre">seekable()</span></code></a> to make an instance a
stream-like object and allow wrapping it with <a class="reference external" href="https://docs.python.org/3/library/io.html#io.TextIOWrapper" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">io.TextIOWrapper</span></code></a>.</li>
<li>Added the <a class="reference internal" href="../ref/request-response.html#django.http.HttpRequest.content_type" title="django.http.HttpRequest.content_type"><code class="xref py py-attr docutils literal notranslate"><span class="pre">HttpRequest.content_type</span></code></a> and
<a class="reference internal" href="../ref/request-response.html#django.http.HttpRequest.content_params" title="django.http.HttpRequest.content_params"><code class="xref py py-attr docutils literal notranslate"><span class="pre">content_params</span></code></a> attributes which are
parsed from the <code class="docutils literal notranslate"><span class="pre">CONTENT_TYPE</span></code> header.</li>
<li>The parser for <code class="docutils literal notranslate"><span class="pre">request.COOKIES</span></code> is simplified to better match the behavior
of browsers. <code class="docutils literal notranslate"><span class="pre">request.COOKIES</span></code> may now contain cookies that are invalid
according to <span class="target" id="index-0"></span><a class="rfc reference external" href="https://tools.ietf.org/html/rfc6265.html"><strong>RFC 6265</strong></a> but are possible to set via <code class="docutils literal notranslate"><span class="pre">document.cookie</span></code>.</li>
</ul>
</div>
<div class="section" id="s-serialization">
<span id="serialization"></span><h4>Serialization<a class="headerlink" href="#serialization" title="Permalink to this headline">¶</a></h4>
<ul class="simple">
<li>The <code class="docutils literal notranslate"><span class="pre">django.core.serializers.json.DjangoJSONEncoder</span></code> now knows how to
serialize lazy strings, typically used for translatable content.</li>
</ul>
</div>
<div class="section" id="s-templates">
<span id="templates"></span><h4>Templates<a class="headerlink" href="#templates" title="Permalink to this headline">¶</a></h4>
<ul class="simple">
<li>Added the <code class="docutils literal notranslate"><span class="pre">autoescape</span></code> option to the
<a class="reference internal" href="../topics/templates.html#django.template.backends.django.DjangoTemplates" title="django.template.backends.django.DjangoTemplates"><code class="xref py py-class docutils literal notranslate"><span class="pre">DjangoTemplates</span></code></a> backend and the
<a class="reference internal" href="../ref/templates/api.html#django.template.Engine" title="django.template.Engine"><code class="xref py py-class docutils literal notranslate"><span class="pre">Engine</span></code></a> class.</li>
<li>Added the <code class="docutils literal notranslate"><span class="pre">is</span></code> and <code class="docutils literal notranslate"><span class="pre">is</span> <span class="pre">not</span></code> comparison operators to the <a class="reference internal" href="../ref/templates/builtins.html#std:templatetag-if"><code class="xref std std-ttag docutils literal notranslate"><span class="pre">if</span></code></a> tag.</li>
<li>Allowed <a class="reference internal" href="../ref/templates/builtins.html#std:templatefilter-dictsort"><code class="xref std std-tfilter docutils literal notranslate"><span class="pre">dictsort</span></code></a> to order a list of lists by an element at a
specified index.</li>
<li>The <a class="reference internal" href="../ref/templates/api.html#django.template.context_processors.debug" title="django.template.context_processors.debug"><code class="xref py py-func docutils literal notranslate"><span class="pre">debug()</span></code></a> context processor
contains queries for all database aliases instead of only the default alias.</li>
<li>Added relative path support for string arguments of the <a class="reference internal" href="../ref/templates/builtins.html#std:templatetag-extends"><code class="xref std std-ttag docutils literal notranslate"><span class="pre">extends</span></code></a> and
<a class="reference internal" href="../ref/templates/builtins.html#std:templatetag-include"><code class="xref std std-ttag docutils literal notranslate"><span class="pre">include</span></code></a> template tags.</li>
</ul>
</div>
<div class="section" id="s-tests">
<span id="tests"></span><h4>Tests<a class="headerlink" href="#tests" title="Permalink to this headline">¶</a></h4>
<ul class="simple">
<li>To better catch bugs, <a class="reference internal" href="../topics/testing/tools.html#django.test.TestCase" title="django.test.TestCase"><code class="xref py py-class docutils literal notranslate"><span class="pre">TestCase</span></code></a> now checks deferrable
database constraints at the end of each test.</li>
<li>Tests and test cases can be <a class="reference internal" href="../topics/testing/tools.html#topics-tagging-tests"><span class="std std-ref">marked with tags</span></a>
and run selectively with the new <a class="reference internal" href="../ref/django-admin.html#cmdoption-test-tag"><code class="xref std std-option docutils literal notranslate"><span class="pre">test</span> <span class="pre">--tag</span></code></a> and <a class="reference internal" href="../ref/django-admin.html#cmdoption-test-exclude-tag"><code class="xref std std-option docutils literal notranslate"><span class="pre">test</span>
<span class="pre">--exclude-tag</span></code></a> options.</li>
<li>You can now login and use sessions with the test client even if
<a class="reference internal" href="../topics/http/sessions.html#module-django.contrib.sessions" title="django.contrib.sessions: Provides session management for Django projects."><code class="xref py py-mod docutils literal notranslate"><span class="pre">django.contrib.sessions</span></code></a> is not in <a class="reference internal" href="../ref/settings.html#std:setting-INSTALLED_APPS"><code class="xref std std-setting docutils literal notranslate"><span class="pre">INSTALLED_APPS</span></code></a>.</li>
</ul>
</div>
<div class="section" id="s-urls">
<span id="urls"></span><h4>URLs<a class="headerlink" href="#urls" title="Permalink to this headline">¶</a></h4>
<ul class="simple">
<li>An addition in <a class="reference internal" href="../ref/applications.html#django.setup" title="django.setup"><code class="xref py py-func docutils literal notranslate"><span class="pre">django.setup()</span></code></a> allows URL resolving that happens
outside of the request/response cycle (e.g. in management commands and
standalone scripts) to take <a class="reference internal" href="../ref/settings.html#std:setting-FORCE_SCRIPT_NAME"><code class="xref std std-setting docutils literal notranslate"><span class="pre">FORCE_SCRIPT_NAME</span></code></a> into account when it
is set.</li>
</ul>
</div>
<div class="section" id="s-validators">
<span id="validators"></span><h4>Validators<a class="headerlink" href="#validators" title="Permalink to this headline">¶</a></h4>
<ul class="simple">
<li><a class="reference internal" href="../ref/validators.html#django.core.validators.URLValidator" title="django.core.validators.URLValidator"><code class="xref py py-class docutils literal notranslate"><span class="pre">URLValidator</span></code></a> now limits the length of
domain name labels to 63 characters and the total length of domain
names to 253 characters per <span class="target" id="index-1"></span><a class="rfc reference external" href="https://tools.ietf.org/html/rfc1034.html"><strong>RFC 1034</strong></a>.</li>
<li><a class="reference internal" href="../ref/validators.html#django.core.validators.int_list_validator" title="django.core.validators.int_list_validator"><code class="xref py py-func docutils literal notranslate"><span class="pre">int_list_validator()</span></code></a> now accepts an optional
<code class="docutils literal notranslate"><span class="pre">allow_negative</span></code> boolean parameter, defaulting to <code class="docutils literal notranslate"><span class="pre">False</span></code>, to allow
negative integers.</li>
</ul>
</div>
</div>
</div>
<div class="section" id="s-backwards-incompatible-changes-in-1-10">
<span id="s-backwards-incompatible-1-10"></span><span id="backwards-incompatible-changes-in-1-10"></span><span id="backwards-incompatible-1-10"></span><h2>Backwards incompatible changes in 1.10<a class="headerlink" href="#backwards-incompatible-changes-in-1-10" title="Permalink to this headline">¶</a></h2>
<div class="admonition warning">
<p class="first admonition-title">Warning</p>
<p class="last">In addition to the changes outlined in this section, be sure to review the
<a class="reference internal" href="#removed-features-1-10"><span class="std std-ref">Features removed in 1.10</span></a> for the features that have reached the end of
their deprecation cycle and therefore been removed. If you haven’t updated
your code within the deprecation timeline for a given feature, its removal
may appear as a backwards incompatible change.</p>
</div>
<div class="section" id="s-database-backend-api">
<span id="database-backend-api"></span><h3>Database backend API<a class="headerlink" href="#database-backend-api" title="Permalink to this headline">¶</a></h3>
<ul class="simple">
<li>GIS’s <code class="docutils literal notranslate"><span class="pre">AreaField</span></code> uses an unspecified underlying numeric type that could in
practice be any numeric Python type. <code class="docutils literal notranslate"><span class="pre">decimal.Decimal</span></code> values retrieved
from the database are now converted to <code class="docutils literal notranslate"><span class="pre">float</span></code> to make it easier to combine
them with values used by the GIS libraries.</li>
<li>In order to enable temporal subtraction you must set the
<code class="docutils literal notranslate"><span class="pre">supports_temporal_subtraction</span></code> database feature flag to <code class="docutils literal notranslate"><span class="pre">True</span></code> and
implement the <code class="docutils literal notranslate"><span class="pre">DatabaseOperations.subtract_temporals()</span></code> method. This
method should return the SQL and parameters required to compute the
difference in microseconds between the <code class="docutils literal notranslate"><span class="pre">lhs</span></code> and <code class="docutils literal notranslate"><span class="pre">rhs</span></code> arguments in the
datatype used to store <a class="reference internal" href="../ref/models/fields.html#django.db.models.DurationField" title="django.db.models.DurationField"><code class="xref py py-class docutils literal notranslate"><span class="pre">DurationField</span></code></a>.</li>
</ul>
</div>
<div class="section" id="s-select-related-prohibits-non-relational-fields-for-nested-relations">
<span id="select-related-prohibits-non-relational-fields-for-nested-relations"></span><h3><code class="docutils literal notranslate"><span class="pre">select_related()</span></code> prohibits non-relational fields for nested relations<a class="headerlink" href="#select-related-prohibits-non-relational-fields-for-nested-relations" title="Permalink to this headline">¶</a></h3>
<p>Django 1.8 added validation for non-relational fields in <code class="docutils literal notranslate"><span class="pre">select_related()</span></code>:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">Book</span><span class="o">.</span><span class="n">objects</span><span class="o">.</span><span class="n">select_related</span><span class="p">(</span><span class="s1">&#39;title&#39;</span><span class="p">)</span>
<span class="gt">Traceback (most recent call last):</span>
<span class="c">...</span>
<span class="gr">FieldError</span>: <span class="n">Non-relational field given in select_related: &#39;title&#39;</span>
</pre></div>
</div>
<p>But it didn’t prohibit nested non-relation fields as it does now:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">Book</span><span class="o">.</span><span class="n">objects</span><span class="o">.</span><span class="n">select_related</span><span class="p">(</span><span class="s1">&#39;author__name&#39;</span><span class="p">)</span>
<span class="gt">Traceback (most recent call last):</span>
<span class="c">...</span>
<span class="gr">FieldError</span>: <span class="n">Non-relational field given in select_related: &#39;name&#39;</span>
</pre></div>
</div>
</div>
<div class="section" id="s-meta-get-fields-returns-consistent-reverse-fields-for-proxy-models">
<span id="meta-get-fields-returns-consistent-reverse-fields-for-proxy-models"></span><h3><code class="docutils literal notranslate"><span class="pre">_meta.get_fields()</span></code> returns consistent reverse fields for proxy models<a class="headerlink" href="#meta-get-fields-returns-consistent-reverse-fields-for-proxy-models" title="Permalink to this headline">¶</a></h3>
<p>Before Django 1.10, the <a class="reference internal" href="../ref/models/meta.html#django.db.models.options.Options.get_fields" title="django.db.models.options.Options.get_fields"><code class="xref py py-meth docutils literal notranslate"><span class="pre">get_fields()</span></code></a>
method returned different reverse fields when called on a proxy model compared
to its proxied concrete class. This inconsistency was fixed by returning the
full set of fields pointing to a concrete class or one of its proxies in both
cases.</p>
</div>
<div class="section" id="s-abstractuser-username-max-length-increased-to-150">
<span id="abstractuser-username-max-length-increased-to-150"></span><h3><a class="reference internal" href="../ref/contrib/auth.html#django.contrib.auth.models.User.username" title="django.contrib.auth.models.User.username"><code class="xref py py-attr docutils literal notranslate"><span class="pre">AbstractUser.username</span></code></a> <code class="docutils literal notranslate"><span class="pre">max_length</span></code> increased to 150<a class="headerlink" href="#abstractuser-username-max-length-increased-to-150" title="Permalink to this headline">¶</a></h3>
<p>A migration for <a class="reference internal" href="../ref/contrib/auth.html#django.contrib.auth.models.User.username" title="django.contrib.auth.models.User.username"><code class="xref py py-attr docutils literal notranslate"><span class="pre">django.contrib.auth.models.User.username</span></code></a> is included.
If you have a custom user model inheriting from <code class="docutils literal notranslate"><span class="pre">AbstractUser</span></code>, you’ll need
to generate and apply a database migration for your user model.</p>
<p>We considered an increase to 254 characters to more easily allow the use of
email addresses (which are limited to 254 characters) as usernames but rejected
it due to a MySQL limitation.  When using the <code class="docutils literal notranslate"><span class="pre">utf8mb4</span></code> encoding (recommended
for proper Unicode support), MySQL can only create unique indexes with 191
characters by default. Therefore, if you need a longer length, please use a
custom user model.</p>
<p>If you want to preserve the 30 character limit for usernames, use a custom form
when creating a user or changing usernames:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">django.contrib.auth.forms</span> <span class="k">import</span> <span class="n">UserCreationForm</span>

<span class="k">class</span> <span class="nc">MyUserCreationForm</span><span class="p">(</span><span class="n">UserCreationForm</span><span class="p">):</span>
    <span class="n">username</span> <span class="o">=</span> <span class="n">forms</span><span class="o">.</span><span class="n">CharField</span><span class="p">(</span>
        <span class="n">max_length</span><span class="o">=</span><span class="mi">30</span><span class="p">,</span>
        <span class="n">help_text</span><span class="o">=</span><span class="s1">&#39;Required. 30 characters or fewer. Letters, digits and @/./+/-/_ only.&#39;</span><span class="p">,</span>
    <span class="p">)</span>
</pre></div>
</div>
<p>If you wish to keep this restriction in the admin, set <code class="docutils literal notranslate"><span class="pre">UserAdmin.add_form</span></code>
to use this form:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">django.contrib.auth.admin</span> <span class="k">import</span> <span class="n">UserAdmin</span> <span class="k">as</span> <span class="n">BaseUserAdmin</span>
<span class="kn">from</span> <span class="nn">django.contrib.auth.models</span> <span class="k">import</span> <span class="n">User</span>

<span class="k">class</span> <span class="nc">UserAdmin</span><span class="p">(</span><span class="n">BaseUserAdmin</span><span class="p">):</span>
    <span class="n">add_form</span> <span class="o">=</span> <span class="n">MyUserCreationForm</span>

<span class="n">admin</span><span class="o">.</span><span class="n">site</span><span class="o">.</span><span class="n">unregister</span><span class="p">(</span><span class="n">User</span><span class="p">)</span>
<span class="n">admin</span><span class="o">.</span><span class="n">site</span><span class="o">.</span><span class="n">register</span><span class="p">(</span><span class="n">User</span><span class="p">,</span> <span class="n">UserAdmin</span><span class="p">)</span>
</pre></div>
</div>
</div>
<div class="section" id="s-dropped-support-for-postgresql-9-1">
<span id="dropped-support-for-postgresql-9-1"></span><h3>Dropped support for PostgreSQL 9.1<a class="headerlink" href="#dropped-support-for-postgresql-9-1" title="Permalink to this headline">¶</a></h3>
<p>Upstream support for PostgreSQL 9.1 ends in September 2016. As a consequence,
Django 1.10 sets PostgreSQL 9.2 as the minimum version it officially supports.</p>
</div>
<div class="section" id="s-runserver-output-goes-through-logging">
<span id="runserver-output-goes-through-logging"></span><h3><code class="docutils literal notranslate"><span class="pre">runserver</span></code> output goes through logging<a class="headerlink" href="#runserver-output-goes-through-logging" title="Permalink to this headline">¶</a></h3>
<p>Request and response handling of the <code class="docutils literal notranslate"><span class="pre">runserver</span></code> command is sent to the
<a class="reference internal" href="../topics/logging.html#django-server-logger"><span class="std std-ref">django.server</span></a> logger instead of to <code class="docutils literal notranslate"><span class="pre">sys.stderr</span></code>. If you
disable Django’s logging configuration or override it with your own, you’ll
need to add the appropriate logging configuration if you want to see that
output:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="s1">&#39;formatters&#39;</span><span class="p">:</span> <span class="p">{</span>
    <span class="s1">&#39;django.server&#39;</span><span class="p">:</span> <span class="p">{</span>
        <span class="s1">&#39;()&#39;</span><span class="p">:</span> <span class="s1">&#39;django.utils.log.ServerFormatter&#39;</span><span class="p">,</span>
        <span class="s1">&#39;format&#39;</span><span class="p">:</span> <span class="s1">&#39;[</span><span class="si">%(server_time)s</span><span class="s1">] </span><span class="si">%(message)s</span><span class="s1">&#39;</span><span class="p">,</span>
    <span class="p">}</span>
<span class="p">},</span>
<span class="s1">&#39;handlers&#39;</span><span class="p">:</span> <span class="p">{</span>
    <span class="s1">&#39;django.server&#39;</span><span class="p">:</span> <span class="p">{</span>
        <span class="s1">&#39;level&#39;</span><span class="p">:</span> <span class="s1">&#39;INFO&#39;</span><span class="p">,</span>
        <span class="s1">&#39;class&#39;</span><span class="p">:</span> <span class="s1">&#39;logging.StreamHandler&#39;</span><span class="p">,</span>
        <span class="s1">&#39;formatter&#39;</span><span class="p">:</span> <span class="s1">&#39;django.server&#39;</span><span class="p">,</span>
    <span class="p">},</span>
<span class="p">},</span>
<span class="s1">&#39;loggers&#39;</span><span class="p">:</span> <span class="p">{</span>
    <span class="s1">&#39;django.server&#39;</span><span class="p">:</span> <span class="p">{</span>
        <span class="s1">&#39;handlers&#39;</span><span class="p">:</span> <span class="p">[</span><span class="s1">&#39;django.server&#39;</span><span class="p">],</span>
        <span class="s1">&#39;level&#39;</span><span class="p">:</span> <span class="s1">&#39;INFO&#39;</span><span class="p">,</span>
        <span class="s1">&#39;propagate&#39;</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span>
    <span class="p">}</span>
<span class="p">}</span>
</pre></div>
</div>
</div>
<div class="section" id="s-auth-customuser-and-auth-extensionuser-test-models-were-removed">
<span id="auth-customuser-and-auth-extensionuser-test-models-were-removed"></span><h3><code class="docutils literal notranslate"><span class="pre">auth.CustomUser</span></code> and <code class="docutils literal notranslate"><span class="pre">auth.ExtensionUser</span></code> test models were removed<a class="headerlink" href="#auth-customuser-and-auth-extensionuser-test-models-were-removed" title="Permalink to this headline">¶</a></h3>
<p>Since the introduction of migrations for the contrib apps in Django 1.8, the
tables of these custom user test models were not created anymore making them
unusable in a testing context.</p>
</div>
<div class="section" id="s-apps-registry-is-no-longer-auto-populated-when-unpickling-models-outside-of-django">
<span id="apps-registry-is-no-longer-auto-populated-when-unpickling-models-outside-of-django"></span><h3>Apps registry is no longer auto-populated when unpickling models outside of Django<a class="headerlink" href="#apps-registry-is-no-longer-auto-populated-when-unpickling-models-outside-of-django" title="Permalink to this headline">¶</a></h3>
<p>The apps registry is no longer auto-populated when unpickling models. This was
added in Django 1.7.2 as an attempt to allow unpickling models outside of
Django, such as in an RQ worker, without calling <code class="docutils literal notranslate"><span class="pre">django.setup()</span></code>, but it
creates the possibility of a deadlock. To adapt your code in the case of RQ,
you can <a class="reference external" href="http://python-rq.org/docs/workers/">provide your own worker script</a>
that calls <code class="docutils literal notranslate"><span class="pre">django.setup()</span></code>.</p>
</div>
<div class="section" id="s-removed-null-assignment-check-for-non-null-foreign-key-fields">
<span id="removed-null-assignment-check-for-non-null-foreign-key-fields"></span><h3>Removed null assignment check for non-null foreign key fields<a class="headerlink" href="#removed-null-assignment-check-for-non-null-foreign-key-fields" title="Permalink to this headline">¶</a></h3>
<p>In older versions, assigning <code class="docutils literal notranslate"><span class="pre">None</span></code> to a non-nullable <code class="docutils literal notranslate"><span class="pre">ForeignKey</span></code> or
<code class="docutils literal notranslate"><span class="pre">OneToOneField</span></code> raised <code class="docutils literal notranslate"><span class="pre">ValueError('Cannot</span> <span class="pre">assign</span> <span class="pre">None:</span> <span class="pre">&quot;model.field&quot;</span> <span class="pre">does</span>
<span class="pre">not</span> <span class="pre">allow</span> <span class="pre">null</span> <span class="pre">values.')</span></code>. For consistency with other model fields which don’t
have a similar check, this check is removed.</p>
</div>
<div class="section" id="s-removed-weak-password-hashers-from-the-default-password-hashers-setting">
<span id="removed-weak-password-hashers-from-the-default-password-hashers-setting"></span><h3>Removed weak password hashers from the default <code class="docutils literal notranslate"><span class="pre">PASSWORD_HASHERS</span></code> setting<a class="headerlink" href="#removed-weak-password-hashers-from-the-default-password-hashers-setting" title="Permalink to this headline">¶</a></h3>
<p>Django 0.90 stored passwords as unsalted MD5. Django 0.91 added support for
salted SHA1 with automatic upgrade of passwords when a user logs in. Django 1.4
added PBKDF2 as the default password hasher.</p>
<p>If you have an old Django project with MD5 or SHA1 (even salted) encoded
passwords, be aware that these can be cracked fairly easily with today’s
hardware. To make Django users acknowledge continued use of weak hashers, the
following hashers are removed from the default <a class="reference internal" href="../ref/settings.html#std:setting-PASSWORD_HASHERS"><code class="xref std std-setting docutils literal notranslate"><span class="pre">PASSWORD_HASHERS</span></code></a>
setting:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="s1">&#39;django.contrib.auth.hashers.SHA1PasswordHasher&#39;</span>
<span class="s1">&#39;django.contrib.auth.hashers.MD5PasswordHasher&#39;</span>
<span class="s1">&#39;django.contrib.auth.hashers.UnsaltedSHA1PasswordHasher&#39;</span>
<span class="s1">&#39;django.contrib.auth.hashers.UnsaltedMD5PasswordHasher&#39;</span>
<span class="s1">&#39;django.contrib.auth.hashers.CryptPasswordHasher&#39;</span>
</pre></div>
</div>
<p>Consider using a <a class="reference internal" href="../topics/auth/passwords.html#wrapping-password-hashers"><span class="std std-ref">wrapped password hasher</span></a> to
strengthen the hashes in your database. If that’s not feasible, add the
<a class="reference internal" href="../ref/settings.html#std:setting-PASSWORD_HASHERS"><code class="xref std std-setting docutils literal notranslate"><span class="pre">PASSWORD_HASHERS</span></code></a> setting to your project and add back any hashers
that you need.</p>
<p>You can check if your database has any of the removed hashers like this:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">django.contrib.auth</span> <span class="k">import</span> <span class="n">get_user_model</span>
<span class="n">User</span> <span class="o">=</span> <span class="n">get_user_model</span><span class="p">()</span>

<span class="c1"># Unsalted MD5/SHA1:</span>
<span class="n">User</span><span class="o">.</span><span class="n">objects</span><span class="o">.</span><span class="n">filter</span><span class="p">(</span><span class="n">password__startswith</span><span class="o">=</span><span class="s1">&#39;md5$$&#39;</span><span class="p">)</span>
<span class="n">User</span><span class="o">.</span><span class="n">objects</span><span class="o">.</span><span class="n">filter</span><span class="p">(</span><span class="n">password__startswith</span><span class="o">=</span><span class="s1">&#39;sha1$$&#39;</span><span class="p">)</span>
<span class="c1"># Salted MD5/SHA1:</span>
<span class="n">User</span><span class="o">.</span><span class="n">objects</span><span class="o">.</span><span class="n">filter</span><span class="p">(</span><span class="n">password__startswith</span><span class="o">=</span><span class="s1">&#39;md5$&#39;</span><span class="p">)</span><span class="o">.</span><span class="n">exclude</span><span class="p">(</span><span class="n">password__startswith</span><span class="o">=</span><span class="s1">&#39;md5$$&#39;</span><span class="p">)</span>
<span class="n">User</span><span class="o">.</span><span class="n">objects</span><span class="o">.</span><span class="n">filter</span><span class="p">(</span><span class="n">password__startswith</span><span class="o">=</span><span class="s1">&#39;sha1$&#39;</span><span class="p">)</span><span class="o">.</span><span class="n">exclude</span><span class="p">(</span><span class="n">password__startswith</span><span class="o">=</span><span class="s1">&#39;sha1$$&#39;</span><span class="p">)</span>
<span class="c1"># Crypt hasher:</span>
<span class="n">User</span><span class="o">.</span><span class="n">objects</span><span class="o">.</span><span class="n">filter</span><span class="p">(</span><span class="n">password__startswith</span><span class="o">=</span><span class="s1">&#39;crypt$$&#39;</span><span class="p">)</span>

<span class="kn">from</span> <span class="nn">django.db.models</span> <span class="k">import</span> <span class="n">CharField</span>
<span class="kn">from</span> <span class="nn">django.db.models.functions</span> <span class="k">import</span> <span class="n">Length</span>
<span class="n">CharField</span><span class="o">.</span><span class="n">register_lookup</span><span class="p">(</span><span class="n">Length</span><span class="p">)</span>
<span class="c1"># Unsalted MD5 passwords might not have an &#39;md5$$&#39; prefix:</span>
<span class="n">User</span><span class="o">.</span><span class="n">objects</span><span class="o">.</span><span class="n">filter</span><span class="p">(</span><span class="n">password__length</span><span class="o">=</span><span class="mi">32</span><span class="p">)</span>
</pre></div>
</div>
</div>
<div class="section" id="s-field-get-prep-lookup-and-field-get-db-prep-lookup-methods-are-removed">
<span id="field-get-prep-lookup-and-field-get-db-prep-lookup-methods-are-removed"></span><h3><code class="docutils literal notranslate"><span class="pre">Field.get_prep_lookup()</span></code> and <code class="docutils literal notranslate"><span class="pre">Field.get_db_prep_lookup()</span></code> methods are removed<a class="headerlink" href="#field-get-prep-lookup-and-field-get-db-prep-lookup-methods-are-removed" title="Permalink to this headline">¶</a></h3>
<p>If you have a custom field that implements either of these methods, register a
custom lookup for it. For example:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">django.db.models</span> <span class="k">import</span> <span class="n">Field</span>
<span class="kn">from</span> <span class="nn">django.db.models.lookups</span> <span class="k">import</span> <span class="n">Exact</span>

<span class="k">class</span> <span class="nc">MyField</span><span class="p">(</span><span class="n">Field</span><span class="p">):</span>
    <span class="o">...</span>

<span class="k">class</span> <span class="nc">MyFieldExact</span><span class="p">(</span><span class="n">Exact</span><span class="p">):</span>
    <span class="k">def</span> <span class="nf">get_prep_lookup</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
        <span class="c1"># do_custom_stuff_for_myfield</span>
        <span class="o">....</span>

<span class="n">MyField</span><span class="o">.</span><span class="n">register_lookup</span><span class="p">(</span><span class="n">MyFieldExact</span><span class="p">)</span>
</pre></div>
</div>
</div>
<div class="section" id="s-id1">
<span id="id1"></span><h3><a class="reference internal" href="../ref/contrib/gis/index.html#module-django.contrib.gis" title="django.contrib.gis: Geographic Information System (GIS) extensions for Django"><code class="xref py py-mod docutils literal notranslate"><span class="pre">django.contrib.gis</span></code></a><a class="headerlink" href="#id1" title="Permalink to this headline">¶</a></h3>
<ul class="simple">
<li>Support for SpatiaLite &lt; 3.0 and GEOS &lt; 3.3 is dropped.</li>
<li>The <code class="docutils literal notranslate"><span class="pre">add_postgis_srs()</span></code> backwards compatibility alias for
<code class="docutils literal notranslate"><span class="pre">django.contrib.gis.utils.add_srs_entry()</span></code> is removed.</li>
<li>On Oracle/GIS, the <a class="reference internal" href="../ref/contrib/gis/functions.html#django.contrib.gis.db.models.functions.Area" title="django.contrib.gis.db.models.functions.Area"><code class="xref py py-class docutils literal notranslate"><span class="pre">Area</span></code></a>
aggregate function now returns a <code class="docutils literal notranslate"><span class="pre">float</span></code> instead of <code class="docutils literal notranslate"><span class="pre">decimal.Decimal</span></code>.
(It’s still wrapped in a measure of square meters.)</li>
<li>The default <a class="reference internal" href="../ref/contrib/gis/geos.html#django.contrib.gis.geos.GEOSGeometry" title="django.contrib.gis.geos.GEOSGeometry"><code class="xref py py-class docutils literal notranslate"><span class="pre">GEOSGeometry</span></code></a> representation (WKT
output) is trimmed by default. That is, instead of
<code class="docutils literal notranslate"><span class="pre">POINT</span> <span class="pre">(23.0000000000000000</span> <span class="pre">5.5000000000000000)</span></code>, you’ll get
<code class="docutils literal notranslate"><span class="pre">POINT</span> <span class="pre">(23</span> <span class="pre">5.5)</span></code>.</li>
</ul>
</div>
<div class="section" id="s-maximum-size-of-a-request-body-and-the-number-of-get-post-parameters-is-limited">
<span id="maximum-size-of-a-request-body-and-the-number-of-get-post-parameters-is-limited"></span><h3>Maximum size of a request body and the number of GET/POST parameters is limited<a class="headerlink" href="#maximum-size-of-a-request-body-and-the-number-of-get-post-parameters-is-limited" title="Permalink to this headline">¶</a></h3>
<p>Two new settings help mitigate denial-of-service attacks via large requests:</p>
<ul class="simple">
<li><a class="reference internal" href="../ref/settings.html#std:setting-DATA_UPLOAD_MAX_MEMORY_SIZE"><code class="xref std std-setting docutils literal notranslate"><span class="pre">DATA_UPLOAD_MAX_MEMORY_SIZE</span></code></a> limits the size that a request body
may be. File uploads don’t count towards this limit.</li>
<li><a class="reference internal" href="../ref/settings.html#std:setting-DATA_UPLOAD_MAX_NUMBER_FIELDS"><code class="xref std std-setting docutils literal notranslate"><span class="pre">DATA_UPLOAD_MAX_NUMBER_FIELDS</span></code></a> limits the number of GET/POST
parameters that are parsed.</li>
</ul>
<p>Applications that receive unusually large form posts may need to tune these
settings.</p>
</div>
<div class="section" id="s-miscellaneous">
<span id="miscellaneous"></span><h3>Miscellaneous<a class="headerlink" href="#miscellaneous" title="Permalink to this headline">¶</a></h3>
<ul class="simple">
<li>The <code class="docutils literal notranslate"><span class="pre">repr()</span></code> of a <code class="docutils literal notranslate"><span class="pre">QuerySet</span></code> is wrapped in <code class="docutils literal notranslate"><span class="pre">&lt;QuerySet</span> <span class="pre">&gt;</span></code> to
disambiguate it from a plain list when debugging.</li>
<li><code class="docutils literal notranslate"><span class="pre">utils.version.get_version()</span></code> returns <span class="target" id="index-2"></span><a class="pep reference external" href="https://www.python.org/dev/peps/pep-0440"><strong>PEP 440</strong></a> compliant release
candidate versions (e.g. ‘1.10rc1’ instead of ‘1.10c1’).</li>
<li>CSRF token values are now required to be strings of 64 alphanumerics; values
of 32 alphanumerics, as set by older versions of Django by default, are
automatically replaced by strings of 64 characters. Other values are
considered invalid. This should only affect developers or users who replace
these tokens.</li>
<li>The <code class="docutils literal notranslate"><span class="pre">LOGOUT_URL</span></code> setting is removed as Django hasn’t made use of it
since pre-1.0. If you use it in your project, you can add it to your
project’s settings. The default value was <code class="docutils literal notranslate"><span class="pre">'/accounts/logout/'</span></code>.</li>
<li>Objects with a <code class="docutils literal notranslate"><span class="pre">close()</span></code> method such as files and generators passed to
<a class="reference internal" href="../ref/request-response.html#django.http.HttpResponse" title="django.http.HttpResponse"><code class="xref py py-class docutils literal notranslate"><span class="pre">HttpResponse</span></code></a> are now closed immediately instead of when
the WSGI server calls <code class="docutils literal notranslate"><span class="pre">close()</span></code> on the response.</li>
<li>A redundant <code class="docutils literal notranslate"><span class="pre">transaction.atomic()</span></code> call in <code class="docutils literal notranslate"><span class="pre">QuerySet.update_or_create()</span></code>
is removed. This may affect query counts tested by
<code class="docutils literal notranslate"><span class="pre">TransactionTestCase.assertNumQueries()</span></code>.</li>
<li>Support for <code class="docutils literal notranslate"><span class="pre">skip_validation</span></code> in <code class="docutils literal notranslate"><span class="pre">BaseCommand.execute(**options)</span></code> is
removed. Use <code class="docutils literal notranslate"><span class="pre">skip_checks</span></code> (added in Django 1.7) instead.</li>
<li><a class="reference internal" href="../ref/django-admin.html#django-admin-loaddata"><code class="xref std std-djadmin docutils literal notranslate"><span class="pre">loaddata</span></code></a> now raises a <code class="docutils literal notranslate"><span class="pre">CommandError</span></code> instead of showing a
warning when the specified fixture file is not found.</li>
<li>Instead of directly accessing the <code class="docutils literal notranslate"><span class="pre">LogEntry.change_message</span></code> attribute, it’s
now better to call the <code class="docutils literal notranslate"><span class="pre">LogEntry.get_change_message()</span></code> method which will
provide the message in the current language.</li>
<li>The default error views now raise <code class="docutils literal notranslate"><span class="pre">TemplateDoesNotExist</span></code> if a nonexistent
<code class="docutils literal notranslate"><span class="pre">template_name</span></code> is specified.</li>
<li>The unused <code class="docutils literal notranslate"><span class="pre">choices</span></code> keyword argument of the <code class="docutils literal notranslate"><span class="pre">Select</span></code> and
<code class="docutils literal notranslate"><span class="pre">SelectMultiple</span></code> widgets’ <code class="docutils literal notranslate"><span class="pre">render()</span></code> method is removed. The <code class="docutils literal notranslate"><span class="pre">choices</span></code>
argument of the <code class="docutils literal notranslate"><span class="pre">render_options()</span></code> method is also removed, making
<code class="docutils literal notranslate"><span class="pre">selected_choices</span></code> the first argument.</li>
<li>Tests that violate deferrable database constraints will now error when run on
a database that supports deferrable constraints.</li>
<li>Built-in management commands now use indexing of keys in <code class="docutils literal notranslate"><span class="pre">options</span></code>, e.g.
<code class="docutils literal notranslate"><span class="pre">options['verbosity']</span></code>, instead of <code class="docutils literal notranslate"><span class="pre">options.get()</span></code> and no longer perform
any type coercion. This could be a problem if you’re calling commands using
<code class="docutils literal notranslate"><span class="pre">Command.execute()</span></code> (which bypasses the argument parser that sets a default
value) instead of <a class="reference internal" href="../ref/django-admin.html#django.core.management.call_command" title="django.core.management.call_command"><code class="xref py py-func docutils literal notranslate"><span class="pre">call_command()</span></code></a>. Instead of
calling <code class="docutils literal notranslate"><span class="pre">Command.execute()</span></code>, pass the command object as the first argument
to <code class="docutils literal notranslate"><span class="pre">call_command()</span></code>.</li>
<li><a class="reference internal" href="../ref/contrib/auth.html#django.contrib.auth.backends.ModelBackend" title="django.contrib.auth.backends.ModelBackend"><code class="xref py py-class docutils literal notranslate"><span class="pre">ModelBackend</span></code></a> and
<a class="reference internal" href="../ref/contrib/auth.html#django.contrib.auth.backends.RemoteUserBackend" title="django.contrib.auth.backends.RemoteUserBackend"><code class="xref py py-class docutils literal notranslate"><span class="pre">RemoteUserBackend</span></code></a> now reject inactive
users. This means that inactive users can’t login and will be logged
out if they are switched from <code class="docutils literal notranslate"><span class="pre">is_active=True</span></code> to <code class="docutils literal notranslate"><span class="pre">False</span></code>. If you need
the previous behavior, use the new
<a class="reference internal" href="../ref/contrib/auth.html#django.contrib.auth.backends.AllowAllUsersModelBackend" title="django.contrib.auth.backends.AllowAllUsersModelBackend"><code class="xref py py-class docutils literal notranslate"><span class="pre">AllowAllUsersModelBackend</span></code></a> or
<a class="reference internal" href="../ref/contrib/auth.html#django.contrib.auth.backends.AllowAllUsersRemoteUserBackend" title="django.contrib.auth.backends.AllowAllUsersRemoteUserBackend"><code class="xref py py-class docutils literal notranslate"><span class="pre">AllowAllUsersRemoteUserBackend</span></code></a>
in <a class="reference internal" href="../ref/settings.html#std:setting-AUTHENTICATION_BACKENDS"><code class="xref std std-setting docutils literal notranslate"><span class="pre">AUTHENTICATION_BACKENDS</span></code></a> instead.</li>
<li>In light of the previous change, the test client’s
<a class="reference internal" href="../topics/testing/tools.html#django.test.Client.login" title="django.test.Client.login"><code class="xref py py-meth docutils literal notranslate"><span class="pre">login()</span></code></a> method no longer always rejects inactive
users but instead delegates this decision to the authentication backend.
<a class="reference internal" href="../topics/testing/tools.html#django.test.Client.force_login" title="django.test.Client.force_login"><code class="xref py py-meth docutils literal notranslate"><span class="pre">force_login()</span></code></a> also delegates the decision to the
authentication backend, so if you’re using the default backends, you need to
use an active user.</li>
<li><a class="reference internal" href="../topics/i18n/translation.html#django.views.i18n.set_language" title="django.views.i18n.set_language"><code class="xref py py-func docutils literal notranslate"><span class="pre">django.views.i18n.set_language()</span></code></a> may now return a 204 status code for
AJAX requests.</li>
<li>The <code class="docutils literal notranslate"><span class="pre">base_field</span></code> attribute of
<a class="reference internal" href="../ref/contrib/postgres/fields.html#django.contrib.postgres.fields.RangeField" title="django.contrib.postgres.fields.RangeField"><code class="xref py py-class docutils literal notranslate"><span class="pre">RangeField</span></code></a> is now a type of field,
not an instance of a field.  If you have created a custom subclass of
<a class="reference internal" href="../ref/contrib/postgres/fields.html#django.contrib.postgres.fields.RangeField" title="django.contrib.postgres.fields.RangeField"><code class="xref py py-class docutils literal notranslate"><span class="pre">RangeField</span></code></a>, you should change the
<code class="docutils literal notranslate"><span class="pre">base_field</span></code> attribute.</li>
<li>Middleware classes are now initialized when the server starts rather than
during the first request.</li>
<li>If you override <code class="docutils literal notranslate"><span class="pre">is_authenticated()</span></code> or <code class="docutils literal notranslate"><span class="pre">is_anonymous()</span></code> in a custom user
model, you must convert them to attributes or properties as described in
<a class="reference internal" href="#user-is-auth-anon-deprecation"><span class="std std-ref">the deprecation note</span></a>.</li>
<li>When using <a class="reference internal" href="../ref/contrib/admin/index.html#django.contrib.admin.ModelAdmin.save_as" title="django.contrib.admin.ModelAdmin.save_as"><code class="xref py py-attr docutils literal notranslate"><span class="pre">ModelAdmin.save_as=True</span></code></a>, the “Save as new” button now
redirects to the change view for the new object instead of to the model’s
changelist. If you need the previous behavior, set the new
<a class="reference internal" href="../ref/contrib/admin/index.html#django.contrib.admin.ModelAdmin.save_as_continue" title="django.contrib.admin.ModelAdmin.save_as_continue"><code class="xref py py-attr docutils literal notranslate"><span class="pre">ModelAdmin.save_as_continue</span></code></a> attribute to <code class="docutils literal notranslate"><span class="pre">False</span></code>.</li>
<li>Required form fields now have the <code class="docutils literal notranslate"><span class="pre">required</span></code> HTML attribute. Set the
<a class="reference internal" href="../ref/forms/api.html#django.forms.Form.use_required_attribute" title="django.forms.Form.use_required_attribute"><code class="xref py py-attr docutils literal notranslate"><span class="pre">Form.use_required_attribute</span></code></a>
attribute to <code class="docutils literal notranslate"><span class="pre">False</span></code> to disable it. You could also add the <code class="docutils literal notranslate"><span class="pre">novalidate</span></code>
attribute to <code class="docutils literal notranslate"><span class="pre">&lt;form&gt;</span></code> if you don’t want browser validation. To disable
the <code class="docutils literal notranslate"><span class="pre">required</span></code> attribute on custom widgets, override the
<a class="reference internal" href="../ref/forms/widgets.html#django.forms.Widget.use_required_attribute" title="django.forms.Widget.use_required_attribute"><code class="xref py py-meth docutils literal notranslate"><span class="pre">Widget.use_required_attribute()</span></code></a>
method.</li>
<li>The WSGI handler no longer removes content of responses from <code class="docutils literal notranslate"><span class="pre">HEAD</span></code>
requests or responses with a <code class="docutils literal notranslate"><span class="pre">status_code</span></code> of 100-199, 204, or 304. Most
Web servers already implement this behavior. Responses retrieved using the
Django test client continue to have these “response fixes” applied.</li>
<li><code class="docutils literal notranslate"><span class="pre">Model.__init__()</span></code> now receives <code class="docutils literal notranslate"><span class="pre">django.db.models.DEFERRED</span></code> as the value
of deferred fields.</li>
<li>The <code class="docutils literal notranslate"><span class="pre">Model._deferred</span></code> attribute is removed as dynamic model classes when
using <code class="docutils literal notranslate"><span class="pre">QuerySet.defer()</span></code> and <code class="docutils literal notranslate"><span class="pre">only()</span></code> is removed.</li>
<li><a class="reference internal" href="../ref/files/storage.html#django.core.files.storage.Storage.save" title="django.core.files.storage.Storage.save"><code class="xref py py-meth docutils literal notranslate"><span class="pre">Storage.save()</span></code></a> no longer
replaces <code class="docutils literal notranslate"><span class="pre">'\'</span></code> with <code class="docutils literal notranslate"><span class="pre">'/'</span></code>. This behavior is moved to
<a class="reference internal" href="../ref/files/storage.html#django.core.files.storage.FileSystemStorage" title="django.core.files.storage.FileSystemStorage"><code class="xref py py-class docutils literal notranslate"><span class="pre">FileSystemStorage</span></code></a> since this is a storage
specific implementation detail. Any Windows user with a custom storage
implementation that relies on this behavior will need to implement it in the
custom storage’s <code class="docutils literal notranslate"><span class="pre">save()</span></code> method.</li>
<li>Private <a class="reference internal" href="../ref/models/fields.html#django.db.models.FileField" title="django.db.models.FileField"><code class="xref py py-class docutils literal notranslate"><span class="pre">FileField</span></code></a> methods <code class="docutils literal notranslate"><span class="pre">get_directory_name()</span></code>
and <code class="docutils literal notranslate"><span class="pre">get_filename()</span></code> are no longer called (and are now deprecated) which is
a backwards incompatible change for users overriding those methods on custom
fields. To adapt such code, override <code class="docutils literal notranslate"><span class="pre">FileField.generate_filename()</span></code> or
<a class="reference internal" href="../ref/files/storage.html#django.core.files.storage.Storage.generate_filename" title="django.core.files.storage.Storage.generate_filename"><code class="xref py py-meth docutils literal notranslate"><span class="pre">Storage.generate_filename()</span></code></a> instead. It
might be possible to use <a class="reference internal" href="../ref/models/fields.html#django.db.models.FileField.upload_to" title="django.db.models.FileField.upload_to"><code class="xref py py-attr docutils literal notranslate"><span class="pre">upload_to</span></code></a> also.</li>
<li>The subject of mail sent by <code class="docutils literal notranslate"><span class="pre">AdminEmailHandler</span></code> is no longer truncated at
989 characters. If you were counting on a limited length, truncate the subject
yourself.</li>
<li>Private expressions <code class="docutils literal notranslate"><span class="pre">django.db.models.expressions.Date</span></code> and <code class="docutils literal notranslate"><span class="pre">DateTime</span></code>
are removed. The new <a class="reference internal" href="../ref/models/database-functions.html#django.db.models.functions.datetime.Trunc" title="django.db.models.functions.datetime.Trunc"><code class="xref py py-class docutils literal notranslate"><span class="pre">Trunc</span></code></a>
expressions provide the same functionality.</li>
<li>The <code class="docutils literal notranslate"><span class="pre">_base_manager</span></code> and <code class="docutils literal notranslate"><span class="pre">_default_manager</span></code> attributes are removed from
model instances. They remain accessible on the model class.</li>
<li>Accessing a deleted field on a model instance, e.g. after <code class="docutils literal notranslate"><span class="pre">del</span> <span class="pre">obj.field</span></code>,
reloads the field’s value instead of raising <code class="docutils literal notranslate"><span class="pre">AttributeError</span></code>.</li>
<li>If you subclass <code class="docutils literal notranslate"><span class="pre">AbstractBaseUser</span></code> and override <code class="docutils literal notranslate"><span class="pre">clean()</span></code>, be sure it
calls <code class="docutils literal notranslate"><span class="pre">super()</span></code>. <a class="reference internal" href="../topics/auth/customizing.html#django.contrib.auth.models.AbstractBaseUser.normalize_username" title="django.contrib.auth.models.AbstractBaseUser.normalize_username"><code class="xref py py-meth docutils literal notranslate"><span class="pre">AbstractBaseUser.normalize_username()</span></code></a> is called in
a new <a class="reference internal" href="../topics/auth/customizing.html#django.contrib.auth.models.AbstractBaseUser.clean" title="django.contrib.auth.models.AbstractBaseUser.clean"><code class="xref py py-meth docutils literal notranslate"><span class="pre">AbstractBaseUser.clean()</span></code></a> method.</li>
<li>Private API <code class="docutils literal notranslate"><span class="pre">django.forms.models.model_to_dict()</span></code> returns a queryset rather
than a list of primary keys for <code class="docutils literal notranslate"><span class="pre">ManyToManyField</span></code>s.</li>
<li>If <code class="docutils literal notranslate"><span class="pre">django.contrib.staticfiles</span></code> is
installed, the <a class="reference internal" href="../ref/templates/builtins.html#std:templatetag-static"><code class="xref std std-ttag docutils literal notranslate"><span class="pre">static</span></code></a>  template tag uses the <code class="docutils literal notranslate"><span class="pre">staticfiles</span></code> storage
to construct the URL rather than simply joining the value with
<code class="docutils literal notranslate"><span class="pre">STATIC_ROOT</span></code>. The new approach encodes the URL, which could be
backwards-incompatible in cases such as including a fragment in a path, e.g.
<code class="docutils literal notranslate"><span class="pre">{%</span> <span class="pre">static</span> <span class="pre">'img.svg#fragment'</span> <span class="pre">%}</span></code>, since the <code class="docutils literal notranslate"><span class="pre">#</span></code> is encoded as <code class="docutils literal notranslate"><span class="pre">%23</span></code>.
To adapt, move the fragment outside the template tag:
<code class="docutils literal notranslate"><span class="pre">{%</span> <span class="pre">static</span> <span class="pre">'img.svg'</span> <span class="pre">%}#fragment</span></code>.</li>
<li>When <a class="reference internal" href="../ref/settings.html#std:setting-USE_L10N"><code class="xref std std-setting docutils literal notranslate"><span class="pre">USE_L10N</span></code></a> is <code class="docutils literal notranslate"><span class="pre">True</span></code>, localization is now applied for the
<a class="reference internal" href="../ref/templates/builtins.html#std:templatefilter-date"><code class="xref std std-tfilter docutils literal notranslate"><span class="pre">date</span></code></a> and <a class="reference internal" href="../ref/templates/builtins.html#std:templatefilter-time"><code class="xref std std-tfilter docutils literal notranslate"><span class="pre">time</span></code></a> filters when no format string is
specified. The <code class="docutils literal notranslate"><span class="pre">DATE_FORMAT</span></code> and <code class="docutils literal notranslate"><span class="pre">TIME_FORMAT</span></code> specifiers from the active
locale are used instead of the settings of the same name.</li>
</ul>
</div>
</div>
<div class="section" id="s-features-deprecated-in-1-10">
<span id="s-deprecated-features-1-10"></span><span id="features-deprecated-in-1-10"></span><span id="deprecated-features-1-10"></span><h2>Features deprecated in 1.10<a class="headerlink" href="#features-deprecated-in-1-10" title="Permalink to this headline">¶</a></h2>
<div class="section" id="s-direct-assignment-to-a-reverse-foreign-key-or-many-to-many-relation">
<span id="direct-assignment-to-a-reverse-foreign-key-or-many-to-many-relation"></span><h3>Direct assignment to a reverse foreign key or many-to-many relation<a class="headerlink" href="#direct-assignment-to-a-reverse-foreign-key-or-many-to-many-relation" title="Permalink to this headline">¶</a></h3>
<p>Instead of assigning related objects using direct assignment:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">new_list</span> <span class="o">=</span> <span class="p">[</span><span class="n">obj1</span><span class="p">,</span> <span class="n">obj2</span><span class="p">,</span> <span class="n">obj3</span><span class="p">]</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">e</span><span class="o">.</span><span class="n">related_set</span> <span class="o">=</span> <span class="n">new_list</span>
</pre></div>
</div>
<p>Use the <a class="reference internal" href="../ref/models/relations.html#django.db.models.fields.related.RelatedManager.set" title="django.db.models.fields.related.RelatedManager.set"><code class="xref py py-meth docutils literal notranslate"><span class="pre">set()</span></code></a> method
added in Django 1.9:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">e</span><span class="o">.</span><span class="n">related_set</span><span class="o">.</span><span class="n">set</span><span class="p">([</span><span class="n">obj1</span><span class="p">,</span> <span class="n">obj2</span><span class="p">,</span> <span class="n">obj3</span><span class="p">])</span>
</pre></div>
</div>
<p>This prevents confusion about an assignment resulting in an implicit save.</p>
</div>
<div class="section" id="s-non-timezone-aware-storage-api">
<span id="non-timezone-aware-storage-api"></span><h3>Non-timezone-aware <a class="reference internal" href="../ref/files/storage.html#django.core.files.storage.Storage" title="django.core.files.storage.Storage"><code class="xref py py-class docutils literal notranslate"><span class="pre">Storage</span></code></a> API<a class="headerlink" href="#non-timezone-aware-storage-api" title="Permalink to this headline">¶</a></h3>
<p>The old, non-timezone-aware methods <code class="docutils literal notranslate"><span class="pre">accessed_time()</span></code>, <code class="docutils literal notranslate"><span class="pre">created_time()</span></code>,
and <code class="docutils literal notranslate"><span class="pre">modified_time()</span></code> are deprecated in favor of the new <code class="docutils literal notranslate"><span class="pre">get_*_time()</span></code>
methods.</p>
<p>Third-party storage backends should implement the new methods and mark the old
ones as deprecated. Until then, the new <code class="docutils literal notranslate"><span class="pre">get_*_time()</span></code> methods on the base
<a class="reference internal" href="../ref/files/storage.html#django.core.files.storage.Storage" title="django.core.files.storage.Storage"><code class="xref py py-class docutils literal notranslate"><span class="pre">Storage</span></code></a> class convert <code class="docutils literal notranslate"><span class="pre">datetime</span></code>s from
the old methods as required and emit a deprecation warning as they do so.</p>
<p>Third-party storage backends may retain the old methods as long as they
wish to support earlier versions of Django.</p>
</div>
<div class="section" id="s-id2">
<span id="id2"></span><h3><a class="reference internal" href="../ref/contrib/gis/index.html#module-django.contrib.gis" title="django.contrib.gis: Geographic Information System (GIS) extensions for Django"><code class="xref py py-mod docutils literal notranslate"><span class="pre">django.contrib.gis</span></code></a><a class="headerlink" href="#id2" title="Permalink to this headline">¶</a></h3>
<ul class="simple">
<li>The <code class="docutils literal notranslate"><span class="pre">get_srid()</span></code> and <code class="docutils literal notranslate"><span class="pre">set_srid()</span></code> methods of
<a class="reference internal" href="../ref/contrib/gis/geos.html#django.contrib.gis.geos.GEOSGeometry" title="django.contrib.gis.geos.GEOSGeometry"><code class="xref py py-class docutils literal notranslate"><span class="pre">GEOSGeometry</span></code></a> are deprecated in favor
of the <a class="reference internal" href="../ref/contrib/gis/geos.html#django.contrib.gis.geos.GEOSGeometry.srid" title="django.contrib.gis.geos.GEOSGeometry.srid"><code class="xref py py-attr docutils literal notranslate"><span class="pre">srid</span></code></a> property.</li>
<li>The <code class="docutils literal notranslate"><span class="pre">get_x()</span></code>, <code class="docutils literal notranslate"><span class="pre">set_x()</span></code>, <code class="docutils literal notranslate"><span class="pre">get_y()</span></code>, <code class="docutils literal notranslate"><span class="pre">set_y()</span></code>, <code class="docutils literal notranslate"><span class="pre">get_z()</span></code>, and
<code class="docutils literal notranslate"><span class="pre">set_z()</span></code> methods of <a class="reference internal" href="../ref/contrib/gis/geos.html#django.contrib.gis.geos.Point" title="django.contrib.gis.geos.Point"><code class="xref py py-class docutils literal notranslate"><span class="pre">Point</span></code></a> are deprecated
in favor of the <code class="docutils literal notranslate"><span class="pre">x</span></code>, <code class="docutils literal notranslate"><span class="pre">y</span></code>, and <code class="docutils literal notranslate"><span class="pre">z</span></code> properties.</li>
<li>The <code class="docutils literal notranslate"><span class="pre">get_coords()</span></code> and <code class="docutils literal notranslate"><span class="pre">set_coords()</span></code> methods of
<a class="reference internal" href="../ref/contrib/gis/geos.html#django.contrib.gis.geos.Point" title="django.contrib.gis.geos.Point"><code class="xref py py-class docutils literal notranslate"><span class="pre">Point</span></code></a> are deprecated in favor of the
<code class="docutils literal notranslate"><span class="pre">tuple</span></code> property.</li>
<li>The <code class="docutils literal notranslate"><span class="pre">cascaded_union</span></code> property of
<a class="reference internal" href="../ref/contrib/gis/geos.html#django.contrib.gis.geos.MultiPolygon" title="django.contrib.gis.geos.MultiPolygon"><code class="xref py py-class docutils literal notranslate"><span class="pre">MultiPolygon</span></code></a> is deprecated in favor of the
<a class="reference internal" href="../ref/contrib/gis/geos.html#django.contrib.gis.geos.GEOSGeometry.unary_union" title="django.contrib.gis.geos.GEOSGeometry.unary_union"><code class="xref py py-attr docutils literal notranslate"><span class="pre">unary_union</span></code></a> property.</li>
<li>The <code class="docutils literal notranslate"><span class="pre">django.contrib.gis.utils.precision_wkt()</span></code> function is deprecated in
favor of <a class="reference internal" href="../ref/contrib/gis/geos.html#django.contrib.gis.geos.WKTWriter" title="django.contrib.gis.geos.WKTWriter"><code class="xref py py-class docutils literal notranslate"><span class="pre">WKTWriter</span></code></a>.</li>
</ul>
</div>
<div class="section" id="s-commaseparatedintegerfield-model-field">
<span id="commaseparatedintegerfield-model-field"></span><h3><code class="docutils literal notranslate"><span class="pre">CommaSeparatedIntegerField</span></code> model field<a class="headerlink" href="#commaseparatedintegerfield-model-field" title="Permalink to this headline">¶</a></h3>
<p><code class="docutils literal notranslate"><span class="pre">CommaSeparatedIntegerField</span></code> is deprecated in favor of
<a class="reference internal" href="../ref/models/fields.html#django.db.models.CharField" title="django.db.models.CharField"><code class="xref py py-class docutils literal notranslate"><span class="pre">CharField</span></code></a> with the
<a class="reference internal" href="../ref/validators.html#django.core.validators.validate_comma_separated_integer_list" title="django.core.validators.validate_comma_separated_integer_list"><code class="xref py py-func docutils literal notranslate"><span class="pre">validate_comma_separated_integer_list()</span></code></a>
validator:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">django.core.validators</span> <span class="k">import</span> <span class="n">validate_comma_separated_integer_list</span>
<span class="kn">from</span> <span class="nn">django.db</span> <span class="k">import</span> <span class="n">models</span>

<span class="k">class</span> <span class="nc">MyModel</span><span class="p">(</span><span class="n">models</span><span class="o">.</span><span class="n">Model</span><span class="p">):</span>
    <span class="n">numbers</span> <span class="o">=</span> <span class="n">models</span><span class="o">.</span><span class="n">CharField</span><span class="p">(</span><span class="o">...</span><span class="p">,</span> <span class="n">validators</span><span class="o">=</span><span class="p">[</span><span class="n">validate_comma_separated_integer_list</span><span class="p">])</span>
</pre></div>
</div>
<p>If you’re using Oracle, <code class="docutils literal notranslate"><span class="pre">CharField</span></code> uses a different database field  type
(<code class="docutils literal notranslate"><span class="pre">NVARCHAR2</span></code>) than <code class="docutils literal notranslate"><span class="pre">CommaSeparatedIntegerField</span></code> (<code class="docutils literal notranslate"><span class="pre">VARCHAR2</span></code>). Depending
on your database settings, this might imply a different encoding, and thus a
different length (in bytes) for the same contents. If your stored values are
longer than the 4000 byte limit of <code class="docutils literal notranslate"><span class="pre">NVARCHAR2</span></code>, you should use <code class="docutils literal notranslate"><span class="pre">TextField</span></code>
(<code class="docutils literal notranslate"><span class="pre">NCLOB</span></code>) instead. In this case, if you have any queries that group by the
field (e.g. annotating the model with an aggregation or using <code class="docutils literal notranslate"><span class="pre">distinct()</span></code>)
you’ll need to change them (to defer the field).</p>
</div>
<div class="section" id="s-using-a-model-name-as-a-query-lookup-when-default-related-name-is-set">
<span id="using-a-model-name-as-a-query-lookup-when-default-related-name-is-set"></span><h3>Using a model name as a query lookup when <code class="docutils literal notranslate"><span class="pre">default_related_name</span></code> is set<a class="headerlink" href="#using-a-model-name-as-a-query-lookup-when-default-related-name-is-set" title="Permalink to this headline">¶</a></h3>
<p>Assume the following models:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">django.db</span> <span class="k">import</span> <span class="n">models</span>

<span class="k">class</span> <span class="nc">Foo</span><span class="p">(</span><span class="n">models</span><span class="o">.</span><span class="n">Model</span><span class="p">):</span>
    <span class="k">pass</span>

<span class="k">class</span> <span class="nc">Bar</span><span class="p">(</span><span class="n">models</span><span class="o">.</span><span class="n">Model</span><span class="p">):</span>
    <span class="n">foo</span> <span class="o">=</span> <span class="n">models</span><span class="o">.</span><span class="n">ForeignKey</span><span class="p">(</span><span class="n">Foo</span><span class="p">)</span>

    <span class="k">class</span> <span class="nc">Meta</span><span class="p">:</span>
        <span class="n">default_related_name</span> <span class="o">=</span> <span class="s1">&#39;bars&#39;</span>
</pre></div>
</div>
<p>In older versions, <a class="reference internal" href="../ref/models/options.html#django.db.models.Options.default_related_name" title="django.db.models.Options.default_related_name"><code class="xref py py-attr docutils literal notranslate"><span class="pre">default_related_name</span></code></a>
couldn’t be used as a query lookup. This is fixed and support for the old
lookup name is deprecated. For example, since <code class="docutils literal notranslate"><span class="pre">default_related_name</span></code> is set
in model <code class="docutils literal notranslate"><span class="pre">Bar</span></code>, instead of using the model name <code class="docutils literal notranslate"><span class="pre">bar</span></code> as the lookup:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">bar</span> <span class="o">=</span> <span class="n">Bar</span><span class="o">.</span><span class="n">objects</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">pk</span><span class="o">=</span><span class="mi">1</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">Foo</span><span class="o">.</span><span class="n">objects</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">bar</span><span class="o">=</span><span class="n">bar</span><span class="p">)</span>
</pre></div>
</div>
<p>use the default_related_name <code class="docutils literal notranslate"><span class="pre">bars</span></code>:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">Foo</span><span class="o">.</span><span class="n">objects</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">bars</span><span class="o">=</span><span class="n">bar</span><span class="p">)</span>
</pre></div>
</div>
</div>
<div class="section" id="s-search-query-lookup">
<span id="s-search-lookup-replacement"></span><span id="search-query-lookup"></span><span id="search-lookup-replacement"></span><h3><code class="docutils literal notranslate"><span class="pre">__search</span></code> query lookup<a class="headerlink" href="#search-query-lookup" title="Permalink to this headline">¶</a></h3>
<p>The <code class="docutils literal notranslate"><span class="pre">search</span></code> lookup, which supports MySQL only and is extremely limited in
features, is deprecated. Replace it with a custom lookup:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">django.db</span> <span class="k">import</span> <span class="n">models</span>

<span class="k">class</span> <span class="nc">Search</span><span class="p">(</span><span class="n">models</span><span class="o">.</span><span class="n">Lookup</span><span class="p">):</span>
    <span class="n">lookup_name</span> <span class="o">=</span> <span class="s1">&#39;search&#39;</span>

    <span class="k">def</span> <span class="nf">as_mysql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">compiler</span><span class="p">,</span> <span class="n">connection</span><span class="p">):</span>
        <span class="n">lhs</span><span class="p">,</span> <span class="n">lhs_params</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">process_lhs</span><span class="p">(</span><span class="n">compiler</span><span class="p">,</span> <span class="n">connection</span><span class="p">)</span>
        <span class="n">rhs</span><span class="p">,</span> <span class="n">rhs_params</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">process_rhs</span><span class="p">(</span><span class="n">compiler</span><span class="p">,</span> <span class="n">connection</span><span class="p">)</span>
        <span class="n">params</span> <span class="o">=</span> <span class="n">lhs_params</span> <span class="o">+</span> <span class="n">rhs_params</span>
        <span class="k">return</span> <span class="s1">&#39;MATCH (</span><span class="si">%s</span><span class="s1">) AGAINST (</span><span class="si">%s</span><span class="s1"> IN BOOLEAN MODE)&#39;</span> <span class="o">%</span> <span class="p">(</span><span class="n">lhs</span><span class="p">,</span> <span class="n">rhs</span><span class="p">),</span> <span class="n">params</span>

<span class="n">models</span><span class="o">.</span><span class="n">CharField</span><span class="o">.</span><span class="n">register_lookup</span><span class="p">(</span><span class="n">Search</span><span class="p">)</span>
<span class="n">models</span><span class="o">.</span><span class="n">TextField</span><span class="o">.</span><span class="n">register_lookup</span><span class="p">(</span><span class="n">Search</span><span class="p">)</span>
</pre></div>
</div>
</div>
<div class="section" id="s-using-user-is-authenticated-and-user-is-anonymous-as-methods">
<span id="s-user-is-auth-anon-deprecation"></span><span id="using-user-is-authenticated-and-user-is-anonymous-as-methods"></span><span id="user-is-auth-anon-deprecation"></span><h3>Using <code class="docutils literal notranslate"><span class="pre">User.is_authenticated()</span></code> and <code class="docutils literal notranslate"><span class="pre">User.is_anonymous()</span></code> as methods<a class="headerlink" href="#using-user-is-authenticated-and-user-is-anonymous-as-methods" title="Permalink to this headline">¶</a></h3>
<p>The <code class="docutils literal notranslate"><span class="pre">is_authenticated()</span></code> and <code class="docutils literal notranslate"><span class="pre">is_anonymous()</span></code> methods of
<a class="reference internal" href="../topics/auth/customizing.html#django.contrib.auth.models.AbstractBaseUser" title="django.contrib.auth.models.AbstractBaseUser"><code class="xref py py-class docutils literal notranslate"><span class="pre">AbstractBaseUser</span></code></a> and
<a class="reference internal" href="../ref/contrib/auth.html#django.contrib.auth.models.AnonymousUser" title="django.contrib.auth.models.AnonymousUser"><code class="xref py py-class docutils literal notranslate"><span class="pre">AnonymousUser</span></code></a> classes are now
properties. They will still work as methods until Django 2.0, but all usage
in Django now uses attribute access.</p>
<p>For example, if you use
<a class="reference internal" href="../ref/middleware.html#django.contrib.auth.middleware.AuthenticationMiddleware" title="django.contrib.auth.middleware.AuthenticationMiddleware"><code class="xref py py-class docutils literal notranslate"><span class="pre">AuthenticationMiddleware</span></code></a> and want
to know whether the user is currently logged-in you would use:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="k">if</span> <span class="n">request</span><span class="o">.</span><span class="n">user</span><span class="o">.</span><span class="n">is_authenticated</span><span class="p">:</span>
    <span class="o">...</span> <span class="c1"># Do something for logged-in users.</span>
<span class="k">else</span><span class="p">:</span>
    <span class="o">...</span> <span class="c1"># Do something for anonymous users.</span>
</pre></div>
</div>
<p>instead of <code class="docutils literal notranslate"><span class="pre">request.user.is_authenticated()</span></code>.</p>
<p>This change avoids accidental information leakage if you forget to call the
method, e.g.:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="k">if</span> <span class="n">request</span><span class="o">.</span><span class="n">user</span><span class="o">.</span><span class="n">is_authenticated</span><span class="p">:</span>
    <span class="k">return</span> <span class="n">sensitive_information</span>
</pre></div>
</div>
<p>If you override these methods in a custom user model, you must change them to
properties or attributes.</p>
<p>Django uses a <code class="docutils literal notranslate"><span class="pre">CallableBool</span></code> object to allow these attributes to work as both
a property and a method. Thus, until the deprecation period ends, you cannot
compare these properties using the <code class="docutils literal notranslate"><span class="pre">is</span></code> operator. That is, the following
won’t work:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="k">if</span> <span class="n">request</span><span class="o">.</span><span class="n">user</span><span class="o">.</span><span class="n">is_authenticated</span> <span class="ow">is</span> <span class="kc">True</span><span class="p">:</span>
    <span class="o">...</span>
</pre></div>
</div>
</div>
<div class="section" id="s-custom-manager-classes-available-through-prefetch-related-must-define-a-apply-rel-filters-method">
<span id="custom-manager-classes-available-through-prefetch-related-must-define-a-apply-rel-filters-method"></span><h3>Custom manager classes available through <code class="docutils literal notranslate"><span class="pre">prefetch_related</span></code> must define a <code class="docutils literal notranslate"><span class="pre">_apply_rel_filters()</span></code> method<a class="headerlink" href="#custom-manager-classes-available-through-prefetch-related-must-define-a-apply-rel-filters-method" title="Permalink to this headline">¶</a></h3>
<p>If you defined a custom manager class available through
<a class="reference internal" href="../ref/models/querysets.html#django.db.models.query.QuerySet.prefetch_related" title="django.db.models.query.QuerySet.prefetch_related"><code class="xref py py-meth docutils literal notranslate"><span class="pre">prefetch_related()</span></code></a> you must make sure
it defines a <code class="docutils literal notranslate"><span class="pre">_apply_rel_filters()</span></code> method.</p>
<p>This method must accept a <a class="reference internal" href="../ref/models/querysets.html#django.db.models.query.QuerySet" title="django.db.models.query.QuerySet"><code class="xref py py-class docutils literal notranslate"><span class="pre">QuerySet</span></code></a> instance
as its single argument and return a filtered version of the queryset for the
model instance the manager is bound to.</p>
</div>
<div class="section" id="s-the-escape-half-of-django-utils-safestring">
<span id="the-escape-half-of-django-utils-safestring"></span><h3>The “escape” half of <code class="docutils literal notranslate"><span class="pre">django.utils.safestring</span></code><a class="headerlink" href="#the-escape-half-of-django-utils-safestring" title="Permalink to this headline">¶</a></h3>
<p>The <code class="docutils literal notranslate"><span class="pre">mark_for_escaping()</span></code> function and the classes it uses: <code class="docutils literal notranslate"><span class="pre">EscapeData</span></code>,
<code class="docutils literal notranslate"><span class="pre">EscapeBytes</span></code>, <code class="docutils literal notranslate"><span class="pre">EscapeText</span></code>, <code class="docutils literal notranslate"><span class="pre">EscapeString</span></code>, and <code class="docutils literal notranslate"><span class="pre">EscapeUnicode</span></code> are
deprecated.</p>
<p>As a result, the “lazy” behavior of the <code class="docutils literal notranslate"><span class="pre">escape</span></code> filter (where it would
always be applied as the last filter no matter where in the filter chain it
appeared) is deprecated. The filter will change to immediately apply
<a class="reference internal" href="../ref/utils.html#django.utils.html.conditional_escape" title="django.utils.html.conditional_escape"><code class="xref py py-func docutils literal notranslate"><span class="pre">conditional_escape()</span></code></a> in Django 2.0.</p>
</div>
<div class="section" id="s-manager-use-for-related-fields-and-inheritance-changes">
<span id="manager-use-for-related-fields-and-inheritance-changes"></span><h3><code class="docutils literal notranslate"><span class="pre">Manager.use_for_related_fields</span></code> and inheritance changes<a class="headerlink" href="#manager-use-for-related-fields-and-inheritance-changes" title="Permalink to this headline">¶</a></h3>
<p><code class="docutils literal notranslate"><span class="pre">Manager.use_for_related_fields</span></code> is deprecated in favor of setting
<a class="reference internal" href="../ref/models/options.html#django.db.models.Options.base_manager_name" title="django.db.models.Options.base_manager_name"><code class="xref py py-attr docutils literal notranslate"><span class="pre">Meta.base_manager_name</span></code></a> on
the model.</p>
<p>Model <code class="docutils literal notranslate"><span class="pre">Manager</span></code> inheritance will follow MRO inheritance rules in Django 2.0,
changing the current behavior where managers defined on non-abstract base
classes aren’t inherited by child classes. A deprecating warning with
instructions on how to adapt your code is raised if you have any affected
managers. You’ll either redeclare a manager from an abstract model on the child
class to override the manager from the concrete model, or you’ll set the
model’s <code class="docutils literal notranslate"><span class="pre">Meta.manager_inheritance_from_future=True</span></code> option to opt-in to the
new inheritance behavior.</p>
<p>During the deprecation period, <code class="docutils literal notranslate"><span class="pre">use_for_related_fields</span></code> will be honored and
raise a warning, even if a <code class="docutils literal notranslate"><span class="pre">base_manager_name</span></code> is set. This allows
third-party code to preserve legacy behavior while transitioning to the new
API. The warning can be silenced by setting
<code class="docutils literal notranslate"><span class="pre">silence_use_for_related_fields_deprecation=True</span></code> on the manager.</p>
</div>
<div class="section" id="s-id3">
<span id="id3"></span><h3>Miscellaneous<a class="headerlink" href="#id3" title="Permalink to this headline">¶</a></h3>
<ul class="simple">
<li>The <code class="docutils literal notranslate"><span class="pre">makemigrations</span> <span class="pre">--exit</span></code> option is deprecated in favor of the
<a class="reference internal" href="../ref/django-admin.html#cmdoption-makemigrations-check"><code class="xref std std-option docutils literal notranslate"><span class="pre">makemigrations</span> <span class="pre">--check</span></code></a> option.</li>
<li><code class="docutils literal notranslate"><span class="pre">django.utils.functional.allow_lazy()</span></code> is deprecated in favor of the new
<a class="reference internal" href="../ref/utils.html#django.utils.functional.keep_lazy" title="django.utils.functional.keep_lazy"><code class="xref py py-func docutils literal notranslate"><span class="pre">keep_lazy()</span></code></a> function which can be used with a
more natural decorator syntax.</li>
<li>The <code class="docutils literal notranslate"><span class="pre">shell</span> <span class="pre">--plain</span></code> option is deprecated in favor of <code class="docutils literal notranslate"><span class="pre">-i</span> <span class="pre">python</span></code> or
<code class="docutils literal notranslate"><span class="pre">--interface</span> <span class="pre">python</span></code>.</li>
<li>Importing from the <code class="docutils literal notranslate"><span class="pre">django.core.urlresolvers</span></code> module is deprecated in
favor of its new location, <a class="reference internal" href="../ref/urlresolvers.html#module-django.urls" title="django.urls"><code class="xref py py-mod docutils literal notranslate"><span class="pre">django.urls</span></code></a>.</li>
<li>The template <code class="docutils literal notranslate"><span class="pre">Context.has_key()</span></code> method is deprecated in favor of <code class="docutils literal notranslate"><span class="pre">in</span></code>.</li>
<li>The private attribute <code class="docutils literal notranslate"><span class="pre">virtual_fields</span></code> of <code class="docutils literal notranslate"><span class="pre">Model._meta</span></code> is
deprecated in favor of <code class="docutils literal notranslate"><span class="pre">private_fields</span></code>.</li>
<li>The private keyword arguments <code class="docutils literal notranslate"><span class="pre">virtual_only</span></code> in
<code class="docutils literal notranslate"><span class="pre">Field.contribute_to_class()</span></code> and <code class="docutils literal notranslate"><span class="pre">virtual</span></code> in
<code class="docutils literal notranslate"><span class="pre">Model._meta.add_field()</span></code> are deprecated in favor of <code class="docutils literal notranslate"><span class="pre">private_only</span></code>
and <code class="docutils literal notranslate"><span class="pre">private</span></code>, respectively.</li>
<li>The <code class="docutils literal notranslate"><span class="pre">javascript_catalog()</span></code> and <code class="docutils literal notranslate"><span class="pre">json_catalog()</span></code> views are deprecated in
favor of class-based views <a class="reference internal" href="../topics/i18n/translation.html#django.views.i18n.JavaScriptCatalog" title="django.views.i18n.JavaScriptCatalog"><code class="xref py py-class docutils literal notranslate"><span class="pre">JavaScriptCatalog</span></code></a>
and <a class="reference internal" href="../topics/i18n/translation.html#django.views.i18n.JSONCatalog" title="django.views.i18n.JSONCatalog"><code class="xref py py-class docutils literal notranslate"><span class="pre">JSONCatalog</span></code></a>.</li>
<li>In multi-table inheritance, implicit promotion of a <code class="docutils literal notranslate"><span class="pre">OneToOneField</span></code> to a
<code class="docutils literal notranslate"><span class="pre">parent_link</span></code> is deprecated. Add <code class="docutils literal notranslate"><span class="pre">parent_link=True</span></code> to such fields.</li>
<li>The private API <code class="docutils literal notranslate"><span class="pre">Widget._format_value()</span></code> is made public and renamed to
<a class="reference internal" href="../ref/forms/widgets.html#django.forms.Widget.format_value" title="django.forms.Widget.format_value"><code class="xref py py-meth docutils literal notranslate"><span class="pre">format_value()</span></code></a>. The old name will work
through a deprecation period.</li>
<li>Private <code class="docutils literal notranslate"><span class="pre">FileField</span></code> methods <code class="docutils literal notranslate"><span class="pre">get_directory_name()</span></code> and <code class="docutils literal notranslate"><span class="pre">get_filename()</span></code>
are deprecated in favor of performing this work in
<a class="reference internal" href="../ref/files/storage.html#django.core.files.storage.Storage.generate_filename" title="django.core.files.storage.Storage.generate_filename"><code class="xref py py-meth docutils literal notranslate"><span class="pre">Storage.generate_filename()</span></code></a>).</li>
<li>Old-style middleware that uses  <code class="docutils literal notranslate"><span class="pre">settings.MIDDLEWARE_CLASSES</span></code> are
deprecated. <a class="reference internal" href="../topics/http/middleware.html#upgrading-middleware"><span class="std std-ref">Adapt old, custom middleware</span></a> and
use the new <a class="reference internal" href="../ref/settings.html#std:setting-MIDDLEWARE"><code class="xref std std-setting docutils literal notranslate"><span class="pre">MIDDLEWARE</span></code></a> setting.</li>
</ul>
</div>
</div>
<div class="section" id="s-features-removed-in-1-10">
<span id="s-removed-features-1-10"></span><span id="features-removed-in-1-10"></span><span id="removed-features-1-10"></span><h2>Features removed in 1.10<a class="headerlink" href="#features-removed-in-1-10" title="Permalink to this headline">¶</a></h2>
<p>These features have reached the end of their deprecation cycle and are removed
in Django 1.10. See <a class="reference internal" href="1.8.html#deprecated-features-1-8"><span class="std std-ref">Features deprecated in 1.8</span></a> for details, including how
to remove usage of these features.</p>
<ul class="simple">
<li>Support for calling a <code class="docutils literal notranslate"><span class="pre">SQLCompiler</span></code> directly as an alias for calling its
<code class="docutils literal notranslate"><span class="pre">quote_name_unless_alias</span></code> method is removed.</li>
<li>The <code class="docutils literal notranslate"><span class="pre">cycle</span></code> and <code class="docutils literal notranslate"><span class="pre">firstof</span></code> template tags are removed from the <code class="docutils literal notranslate"><span class="pre">future</span></code>
template tag library.</li>
<li><code class="docutils literal notranslate"><span class="pre">django.conf.urls.patterns()</span></code> is removed.</li>
<li>Support for the <code class="docutils literal notranslate"><span class="pre">prefix</span></code> argument to
<code class="docutils literal notranslate"><span class="pre">django.conf.urls.i18n.i18n_patterns()</span></code> is removed.</li>
<li><code class="docutils literal notranslate"><span class="pre">SimpleTestCase.urls</span></code> is removed.</li>
<li>Using an incorrect count of unpacked values in the <code class="docutils literal notranslate"><span class="pre">for</span></code> template tag
raises an exception rather than failing silently.</li>
<li>The ability to <a class="reference internal" href="../ref/urlresolvers.html#django.urls.reverse" title="django.urls.reverse"><code class="xref py py-func docutils literal notranslate"><span class="pre">reverse()</span></code></a> URLs using a dotted Python path
is removed.</li>
<li>The ability to use a dotted Python path for the <code class="docutils literal notranslate"><span class="pre">LOGIN_URL</span></code> and
<code class="docutils literal notranslate"><span class="pre">LOGIN_REDIRECT_URL</span></code> settings is removed.</li>
<li>Support for <code class="docutils literal notranslate"><span class="pre">optparse</span></code> is dropped for custom management commands.</li>
<li>The class <code class="docutils literal notranslate"><span class="pre">django.core.management.NoArgsCommand</span></code> is removed.</li>
<li><code class="docutils literal notranslate"><span class="pre">django.core.context_processors</span></code> module is removed.</li>
<li><code class="docutils literal notranslate"><span class="pre">django.db.models.sql.aggregates</span></code> module is removed.</li>
<li><code class="docutils literal notranslate"><span class="pre">django.contrib.gis.db.models.sql.aggregates</span></code> module is removed.</li>
<li>The following methods and properties of <code class="docutils literal notranslate"><span class="pre">django.db.sql.query.Query</span></code> are
removed:<ul>
<li>Properties: <code class="docutils literal notranslate"><span class="pre">aggregates</span></code> and <code class="docutils literal notranslate"><span class="pre">aggregate_select</span></code></li>
<li>Methods: <code class="docutils literal notranslate"><span class="pre">add_aggregate</span></code>, <code class="docutils literal notranslate"><span class="pre">set_aggregate_mask</span></code>, and
<code class="docutils literal notranslate"><span class="pre">append_aggregate_mask</span></code>.</li>
</ul>
</li>
<li><code class="docutils literal notranslate"><span class="pre">django.template.resolve_variable</span></code> is removed.</li>
<li>The following private APIs are removed from
<a class="reference internal" href="../ref/models/meta.html#django.db.models.options.Options" title="django.db.models.options.Options"><code class="xref py py-class docutils literal notranslate"><span class="pre">django.db.models.options.Options</span></code></a> (<code class="docutils literal notranslate"><span class="pre">Model._meta</span></code>):<ul>
<li><code class="docutils literal notranslate"><span class="pre">get_field_by_name()</span></code></li>
<li><code class="docutils literal notranslate"><span class="pre">get_all_field_names()</span></code></li>
<li><code class="docutils literal notranslate"><span class="pre">get_fields_with_model()</span></code></li>
<li><code class="docutils literal notranslate"><span class="pre">get_concrete_fields_with_model()</span></code></li>
<li><code class="docutils literal notranslate"><span class="pre">get_m2m_with_model()</span></code></li>
<li><code class="docutils literal notranslate"><span class="pre">get_all_related_objects()</span></code></li>
<li><code class="docutils literal notranslate"><span class="pre">get_all_related_objects_with_model()</span></code></li>
<li><code class="docutils literal notranslate"><span class="pre">get_all_related_many_to_many_objects()</span></code></li>
<li><code class="docutils literal notranslate"><span class="pre">get_all_related_m2m_objects_with_model()</span></code></li>
</ul>
</li>
<li>The <code class="docutils literal notranslate"><span class="pre">error_message</span></code> argument of <code class="docutils literal notranslate"><span class="pre">django.forms.RegexField</span></code> is removed.</li>
<li>The <code class="docutils literal notranslate"><span class="pre">unordered_list</span></code> filter no longer supports old style lists.</li>
<li>Support for string <code class="docutils literal notranslate"><span class="pre">view</span></code> arguments to <code class="docutils literal notranslate"><span class="pre">url()</span></code> is removed.</li>
<li>The backward compatible shim  to rename <code class="docutils literal notranslate"><span class="pre">django.forms.Form._has_changed()</span></code>
to <code class="docutils literal notranslate"><span class="pre">has_changed()</span></code> is removed.</li>
<li>The <code class="docutils literal notranslate"><span class="pre">removetags</span></code> template filter is removed.</li>
<li>The <code class="docutils literal notranslate"><span class="pre">remove_tags()</span></code> and <code class="docutils literal notranslate"><span class="pre">strip_entities()</span></code> functions in
<code class="docutils literal notranslate"><span class="pre">django.utils.html</span></code> is removed.</li>
<li>The <code class="docutils literal notranslate"><span class="pre">is_admin_site</span></code> argument to
<code class="docutils literal notranslate"><span class="pre">django.contrib.auth.views.password_reset()</span></code> is removed.</li>
<li><code class="docutils literal notranslate"><span class="pre">django.db.models.field.subclassing.SubfieldBase</span></code> is removed.</li>
<li><code class="docutils literal notranslate"><span class="pre">django.utils.checksums</span></code> is removed.</li>
<li>The <code class="docutils literal notranslate"><span class="pre">original_content_type_id</span></code> attribute on
<code class="docutils literal notranslate"><span class="pre">django.contrib.admin.helpers.InlineAdminForm</span></code> is removed.</li>
<li>The backwards compatibility shim to allow <code class="docutils literal notranslate"><span class="pre">FormMixin.get_form()</span></code> to be
defined with no default value for its <code class="docutils literal notranslate"><span class="pre">form_class</span></code> argument is removed.</li>
<li>The following settings are removed, and <a class="reference internal" href="../ref/templates/upgrading.html"><span class="doc">you must upgrade</span></a> to the <a class="reference internal" href="../ref/settings.html#std:setting-TEMPLATES"><code class="xref std std-setting docutils literal notranslate"><span class="pre">TEMPLATES</span></code></a> setting:<ul>
<li><code class="docutils literal notranslate"><span class="pre">ALLOWED_INCLUDE_ROOTS</span></code></li>
<li><code class="docutils literal notranslate"><span class="pre">TEMPLATE_CONTEXT_PROCESSORS</span></code></li>
<li><code class="docutils literal notranslate"><span class="pre">TEMPLATE_DEBUG</span></code></li>
<li><code class="docutils literal notranslate"><span class="pre">TEMPLATE_DIRS</span></code></li>
<li><code class="docutils literal notranslate"><span class="pre">TEMPLATE_LOADERS</span></code></li>
<li><code class="docutils literal notranslate"><span class="pre">TEMPLATE_STRING_IF_INVALID</span></code></li>
</ul>
</li>
<li>The backwards compatibility alias <code class="docutils literal notranslate"><span class="pre">django.template.loader.BaseLoader</span></code> is
removed.</li>
<li>Django template objects returned by
<a class="reference internal" href="../topics/templates.html#django.template.loader.get_template" title="django.template.loader.get_template"><code class="xref py py-func docutils literal notranslate"><span class="pre">get_template()</span></code></a> and
<a class="reference internal" href="../topics/templates.html#django.template.loader.select_template" title="django.template.loader.select_template"><code class="xref py py-func docutils literal notranslate"><span class="pre">select_template()</span></code></a> no longer accept a
<a class="reference internal" href="../ref/templates/api.html#django.template.Context" title="django.template.Context"><code class="xref py py-class docutils literal notranslate"><span class="pre">Context</span></code></a> in their
<a class="reference internal" href="../topics/templates.html#django.template.backends.base.Template.render" title="django.template.backends.base.Template.render"><code class="xref py py-meth docutils literal notranslate"><span class="pre">render()</span></code></a> method.</li>
<li><a class="reference internal" href="../ref/template-response.html"><span class="doc">Template response APIs</span></a> enforce the use of
<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">dict</span></code></a> and backend-dependent template objects instead of
<a class="reference internal" href="../ref/templates/api.html#django.template.Context" title="django.template.Context"><code class="xref py py-class docutils literal notranslate"><span class="pre">Context</span></code></a> and <a class="reference internal" href="../ref/templates/api.html#django.template.Template" title="django.template.Template"><code class="xref py py-class docutils literal notranslate"><span class="pre">Template</span></code></a>
respectively.</li>
<li>The <code class="docutils literal notranslate"><span class="pre">current_app</span></code> parameter for the following function and classes is
removed:<ul>
<li><code class="docutils literal notranslate"><span class="pre">django.shortcuts.render()</span></code></li>
<li><code class="docutils literal notranslate"><span class="pre">django.template.Context()</span></code></li>
<li><code class="docutils literal notranslate"><span class="pre">django.template.RequestContext()</span></code></li>
<li><code class="docutils literal notranslate"><span class="pre">django.template.response.TemplateResponse()</span></code></li>
</ul>
</li>
<li>The <code class="docutils literal notranslate"><span class="pre">dictionary</span></code> and <code class="docutils literal notranslate"><span class="pre">context_instance</span></code> parameters for the following
functions are removed:<ul>
<li><code class="docutils literal notranslate"><span class="pre">django.shortcuts.render()</span></code></li>
<li><code class="docutils literal notranslate"><span class="pre">django.shortcuts.render_to_response()</span></code></li>
<li><code class="docutils literal notranslate"><span class="pre">django.template.loader.render_to_string()</span></code></li>
</ul>
</li>
<li>The <code class="docutils literal notranslate"><span class="pre">dirs</span></code> parameter for the following functions is removed:<ul>
<li><code class="docutils literal notranslate"><span class="pre">django.template.loader.get_template()</span></code></li>
<li><code class="docutils literal notranslate"><span class="pre">django.template.loader.select_template()</span></code></li>
<li><code class="docutils literal notranslate"><span class="pre">django.shortcuts.render()</span></code></li>
<li><code class="docutils literal notranslate"><span class="pre">django.shortcuts.render_to_response()</span></code></li>
</ul>
</li>
<li>Session verification is enabled regardless of whether or not
<code class="docutils literal notranslate"><span class="pre">'django.contrib.auth.middleware.SessionAuthenticationMiddleware'</span></code> is in
<code class="docutils literal notranslate"><span class="pre">MIDDLEWARE_CLASSES</span></code>. <code class="docutils literal notranslate"><span class="pre">SessionAuthenticationMiddleware</span></code> no longer has
any purpose and can be removed from <code class="docutils literal notranslate"><span class="pre">MIDDLEWARE_CLASSES</span></code>. It’s kept as
a stub until Django 2.0 as a courtesy for users who don’t read this note.</li>
<li>Private attribute <code class="docutils literal notranslate"><span class="pre">django.db.models.Field.related</span></code> is removed.</li>
<li>The <code class="docutils literal notranslate"><span class="pre">--list</span></code> option of the <code class="docutils literal notranslate"><span class="pre">migrate</span></code> management command is removed.</li>
<li>The <code class="docutils literal notranslate"><span class="pre">ssi</span></code> template tag is removed.</li>
<li>Support for the <code class="docutils literal notranslate"><span class="pre">=</span></code> comparison operator in the <code class="docutils literal notranslate"><span class="pre">if</span></code> template tag is
removed.</li>
<li>The backwards compatibility shims to allow <code class="docutils literal notranslate"><span class="pre">Storage.get_available_name()</span></code>
and <code class="docutils literal notranslate"><span class="pre">Storage.save()</span></code> to be defined without a <code class="docutils literal notranslate"><span class="pre">max_length</span></code> argument are
removed.</li>
<li>Support for the legacy <code class="docutils literal notranslate"><span class="pre">%(&lt;foo&gt;)s</span></code> syntax in <code class="docutils literal notranslate"><span class="pre">ModelFormMixin.success_url</span></code>
is removed.</li>
<li><code class="docutils literal notranslate"><span class="pre">GeoQuerySet</span></code> aggregate methods <code class="docutils literal notranslate"><span class="pre">collect()</span></code>, <code class="docutils literal notranslate"><span class="pre">extent()</span></code>, <code class="docutils literal notranslate"><span class="pre">extent3d()</span></code>,
<code class="docutils literal notranslate"><span class="pre">make_line()</span></code>, and <code class="docutils literal notranslate"><span class="pre">unionagg()</span></code> are removed.</li>
<li>The ability to specify <code class="docutils literal notranslate"><span class="pre">ContentType.name</span></code> when creating a content type
instance is removed.</li>
<li>Support for the old signature of <code class="docutils literal notranslate"><span class="pre">allow_migrate</span></code> is removed.</li>
<li>Support for the syntax of <code class="docutils literal notranslate"><span class="pre">{%</span> <span class="pre">cycle</span> <span class="pre">%}</span></code> that uses comma-separated arguments
is removed.</li>
<li>The warning that <a class="reference internal" href="../topics/signing.html#django.core.signing.Signer" title="django.core.signing.Signer"><code class="xref py py-class docutils literal notranslate"><span class="pre">Signer</span></code></a> issued when given an
invalid separator is now a <code class="docutils literal notranslate"><span class="pre">ValueError</span></code>.</li>
</ul>
</div>
</div>


          </div>
        </div>
      </div>
      
        
          <div class="yui-b" id="sidebar">
            
      <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
        <div class="sphinxsidebarwrapper">
  <h3><a href="../contents.html">Table of Contents</a></h3>
  <ul>
<li><a class="reference internal" href="#">Django 1.10 release notes</a><ul>
<li><a class="reference internal" href="#python-compatibility">Python compatibility</a></li>
<li><a class="reference internal" href="#what-s-new-in-django-1-10">What’s new in Django 1.10</a><ul>
<li><a class="reference internal" href="#full-text-search-for-postgresql">Full text search for PostgreSQL</a></li>
<li><a class="reference internal" href="#new-style-middleware">New-style middleware</a></li>
<li><a class="reference internal" href="#official-support-for-unicode-usernames">Official support for Unicode usernames</a></li>
<li><a class="reference internal" href="#minor-features">Minor features</a><ul>
<li><a class="reference internal" href="#django-contrib-admin"><code class="docutils literal notranslate"><span class="pre">django.contrib.admin</span></code></a></li>
<li><a class="reference internal" href="#django-contrib-auth"><code class="docutils literal notranslate"><span class="pre">django.contrib.auth</span></code></a></li>
<li><a class="reference internal" href="#django-contrib-gis"><code class="docutils literal notranslate"><span class="pre">django.contrib.gis</span></code></a></li>
<li><a class="reference internal" href="#django-contrib-postgres"><code class="docutils literal notranslate"><span class="pre">django.contrib.postgres</span></code></a></li>
<li><a class="reference internal" href="#django-contrib-sessions"><code class="docutils literal notranslate"><span class="pre">django.contrib.sessions</span></code></a></li>
<li><a class="reference internal" href="#django-contrib-sites"><code class="docutils literal notranslate"><span class="pre">django.contrib.sites</span></code></a></li>
<li><a class="reference internal" href="#django-contrib-staticfiles"><code class="docutils literal notranslate"><span class="pre">django.contrib.staticfiles</span></code></a></li>
<li><a class="reference internal" href="#cache">Cache</a></li>
<li><a class="reference internal" href="#csrf">CSRF</a></li>
<li><a class="reference internal" href="#database-backends">Database backends</a></li>
<li><a class="reference internal" href="#file-storage">File Storage</a></li>
<li><a class="reference internal" href="#forms">Forms</a></li>
<li><a class="reference internal" href="#generic-views">Generic Views</a></li>
<li><a class="reference internal" href="#internationalization">Internationalization</a></li>
<li><a class="reference internal" href="#management-commands">Management Commands</a></li>
<li><a class="reference internal" href="#migrations">Migrations</a></li>
<li><a class="reference internal" href="#models">Models</a></li>
<li><a class="reference internal" href="#requests-and-responses">Requests and Responses</a></li>
<li><a class="reference internal" href="#serialization">Serialization</a></li>
<li><a class="reference internal" href="#templates">Templates</a></li>
<li><a class="reference internal" href="#tests">Tests</a></li>
<li><a class="reference internal" href="#urls">URLs</a></li>
<li><a class="reference internal" href="#validators">Validators</a></li>
</ul>
</li>
</ul>
</li>
<li><a class="reference internal" href="#backwards-incompatible-changes-in-1-10">Backwards incompatible changes in 1.10</a><ul>
<li><a class="reference internal" href="#database-backend-api">Database backend API</a></li>
<li><a class="reference internal" href="#select-related-prohibits-non-relational-fields-for-nested-relations"><code class="docutils literal notranslate"><span class="pre">select_related()</span></code> prohibits non-relational fields for nested relations</a></li>
<li><a class="reference internal" href="#meta-get-fields-returns-consistent-reverse-fields-for-proxy-models"><code class="docutils literal notranslate"><span class="pre">_meta.get_fields()</span></code> returns consistent reverse fields for proxy models</a></li>
<li><a class="reference internal" href="#abstractuser-username-max-length-increased-to-150"><code class="docutils literal notranslate"><span class="pre">AbstractUser.username</span></code> <code class="docutils literal notranslate"><span class="pre">max_length</span></code> increased to 150</a></li>
<li><a class="reference internal" href="#dropped-support-for-postgresql-9-1">Dropped support for PostgreSQL 9.1</a></li>
<li><a class="reference internal" href="#runserver-output-goes-through-logging"><code class="docutils literal notranslate"><span class="pre">runserver</span></code> output goes through logging</a></li>
<li><a class="reference internal" href="#auth-customuser-and-auth-extensionuser-test-models-were-removed"><code class="docutils literal notranslate"><span class="pre">auth.CustomUser</span></code> and <code class="docutils literal notranslate"><span class="pre">auth.ExtensionUser</span></code> test models were removed</a></li>
<li><a class="reference internal" href="#apps-registry-is-no-longer-auto-populated-when-unpickling-models-outside-of-django">Apps registry is no longer auto-populated when unpickling models outside of Django</a></li>
<li><a class="reference internal" href="#removed-null-assignment-check-for-non-null-foreign-key-fields">Removed null assignment check for non-null foreign key fields</a></li>
<li><a class="reference internal" href="#removed-weak-password-hashers-from-the-default-password-hashers-setting">Removed weak password hashers from the default <code class="docutils literal notranslate"><span class="pre">PASSWORD_HASHERS</span></code> setting</a></li>
<li><a class="reference internal" href="#field-get-prep-lookup-and-field-get-db-prep-lookup-methods-are-removed"><code class="docutils literal notranslate"><span class="pre">Field.get_prep_lookup()</span></code> and <code class="docutils literal notranslate"><span class="pre">Field.get_db_prep_lookup()</span></code> methods are removed</a></li>
<li><a class="reference internal" href="#id1"><code class="docutils literal notranslate"><span class="pre">django.contrib.gis</span></code></a></li>
<li><a class="reference internal" href="#maximum-size-of-a-request-body-and-the-number-of-get-post-parameters-is-limited">Maximum size of a request body and the number of GET/POST parameters is limited</a></li>
<li><a class="reference internal" href="#miscellaneous">Miscellaneous</a></li>
</ul>
</li>
<li><a class="reference internal" href="#features-deprecated-in-1-10">Features deprecated in 1.10</a><ul>
<li><a class="reference internal" href="#direct-assignment-to-a-reverse-foreign-key-or-many-to-many-relation">Direct assignment to a reverse foreign key or many-to-many relation</a></li>
<li><a class="reference internal" href="#non-timezone-aware-storage-api">Non-timezone-aware <code class="docutils literal notranslate"><span class="pre">Storage</span></code> API</a></li>
<li><a class="reference internal" href="#id2"><code class="docutils literal notranslate"><span class="pre">django.contrib.gis</span></code></a></li>
<li><a class="reference internal" href="#commaseparatedintegerfield-model-field"><code class="docutils literal notranslate"><span class="pre">CommaSeparatedIntegerField</span></code> model field</a></li>
<li><a class="reference internal" href="#using-a-model-name-as-a-query-lookup-when-default-related-name-is-set">Using a model name as a query lookup when <code class="docutils literal notranslate"><span class="pre">default_related_name</span></code> is set</a></li>
<li><a class="reference internal" href="#search-query-lookup"><code class="docutils literal notranslate"><span class="pre">__search</span></code> query lookup</a></li>
<li><a class="reference internal" href="#using-user-is-authenticated-and-user-is-anonymous-as-methods">Using <code class="docutils literal notranslate"><span class="pre">User.is_authenticated()</span></code> and <code class="docutils literal notranslate"><span class="pre">User.is_anonymous()</span></code> as methods</a></li>
<li><a class="reference internal" href="#custom-manager-classes-available-through-prefetch-related-must-define-a-apply-rel-filters-method">Custom manager classes available through <code class="docutils literal notranslate"><span class="pre">prefetch_related</span></code> must define a <code class="docutils literal notranslate"><span class="pre">_apply_rel_filters()</span></code> method</a></li>
<li><a class="reference internal" href="#the-escape-half-of-django-utils-safestring">The “escape” half of <code class="docutils literal notranslate"><span class="pre">django.utils.safestring</span></code></a></li>
<li><a class="reference internal" href="#manager-use-for-related-fields-and-inheritance-changes"><code class="docutils literal notranslate"><span class="pre">Manager.use_for_related_fields</span></code> and inheritance changes</a></li>
<li><a class="reference internal" href="#id3">Miscellaneous</a></li>
</ul>
</li>
<li><a class="reference internal" href="#features-removed-in-1-10">Features removed in 1.10</a></li>
</ul>
</li>
</ul>

  <h4>Previous topic</h4>
  <p class="topless"><a href="1.10.1.html"
                        title="previous chapter">Django 1.10.1 release notes</a></p>
  <h4>Next topic</h4>
  <p class="topless"><a href="1.9.13.html"
                        title="next chapter">Django 1.9.13 release notes</a></p>
  <div role="note" aria-label="source link">
    <h3>This Page</h3>
    <ul class="this-page-menu">
      <li><a href="../_sources/releases/1.10.txt"
            rel="nofollow">Show Source</a></li>
    </ul>
   </div>
<div id="searchbox" style="display: none" role="search">
  <h3>Quick search</h3>
    <div class="searchformwrapper">
    <form class="search" action="../search.html" method="get">
      <input type="text" name="q" />
      <input type="submit" value="Go" />
      <input type="hidden" name="check_keywords" value="yes" />
      <input type="hidden" name="area" value="default" />
    </form>
    </div>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
        </div>
      </div>
              <h3>Last update:</h3>
              <p class="topless">Jun 03, 2019</p>
          </div>
        
      
    </div>

    <div id="ft">
      <div class="nav">
    &laquo; <a href="1.10.1.html" title="Django 1.10.1 release notes">previous</a>
     |
    <a href="index.html" title="Release notes" accesskey="U">up</a>
   |
    <a href="1.9.13.html" title="Django 1.9.13 release notes">next</a> &raquo;</div>
    </div>
  </div>

      <div class="clearer"></div>
    </div>
  </body>
</html>